@gnsx/three 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/build/three.cjs +79695 -0
- package/build/three.core.js +59732 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +19552 -0
- package/build/three.module.min.js +6 -0
- package/build/three.tsl.js +654 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +83969 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +83702 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/Addons.js +293 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.js +595 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.js +3539 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.js +451 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.js +1963 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.js +1001 -0
- package/examples/jsm/controls/TransformControls.js +1950 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.js +209 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.js +307 -0
- package/examples/jsm/csm/CSMShadowNode.js +603 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.js +155 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.js +310 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.js +311 -0
- package/examples/jsm/exporters/EXRExporter.js +618 -0
- package/examples/jsm/exporters/GLTFExporter.js +3738 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.js +308 -0
- package/examples/jsm/exporters/PLYExporter.js +562 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.js +1254 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.js +165 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.js +519 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +601 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2672 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14506 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.js +703 -0
- package/examples/jsm/lines/LineSegments2.js +426 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +411 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +1836 -0
- package/examples/jsm/loaders/3MFLoader.js +1621 -0
- package/examples/jsm/loaders/AMFLoader.js +541 -0
- package/examples/jsm/loaders/BVHLoader.js +484 -0
- package/examples/jsm/loaders/ColladaLoader.js +153 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.js +739 -0
- package/examples/jsm/loaders/EXRLoader.js +3423 -0
- package/examples/jsm/loaders/FBXLoader.js +4580 -0
- package/examples/jsm/loaders/FontLoader.js +260 -0
- package/examples/jsm/loaders/GCodeLoader.js +318 -0
- package/examples/jsm/loaders/GLTFLoader.js +4860 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +379 -0
- package/examples/jsm/loaders/KMZLoader.js +163 -0
- package/examples/jsm/loaders/KTX2Loader.js +1257 -0
- package/examples/jsm/loaders/KTXLoader.js +197 -0
- package/examples/jsm/loaders/LDrawLoader.js +2510 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
- package/examples/jsm/loaders/LUTImageLoader.js +190 -0
- package/examples/jsm/loaders/LWOLoader.js +1047 -0
- package/examples/jsm/loaders/LottieLoader.js +130 -0
- package/examples/jsm/loaders/MD2Loader.js +435 -0
- package/examples/jsm/loaders/MDDLoader.js +147 -0
- package/examples/jsm/loaders/MTLLoader.js +593 -0
- package/examples/jsm/loaders/MaterialXLoader.js +1104 -0
- package/examples/jsm/loaders/NRRDLoader.js +718 -0
- package/examples/jsm/loaders/OBJLoader.js +955 -0
- package/examples/jsm/loaders/PCDLoader.js +620 -0
- package/examples/jsm/loaders/PDBLoader.js +272 -0
- package/examples/jsm/loaders/PLYLoader.js +805 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/STLLoader.js +421 -0
- package/examples/jsm/loaders/SVGLoader.js +3267 -0
- package/examples/jsm/loaders/TDSLoader.js +1142 -0
- package/examples/jsm/loaders/TGALoader.js +538 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.js +261 -0
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
- package/examples/jsm/loaders/VOXLoader.js +919 -0
- package/examples/jsm/loaders/VRMLLoader.js +3646 -0
- package/examples/jsm/loaders/VTKLoader.js +1293 -0
- package/examples/jsm/loaders/XYZLoader.js +143 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/usd/USDAParser.js +828 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1878 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/Capsule.js +159 -0
- package/examples/jsm/math/ColorConverter.js +58 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.js +822 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/TubePainter.js +599 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +632 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.js +386 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.js +321 -0
- package/examples/jsm/objects/SkyMesh.js +377 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +359 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.js +436 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +185 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.js +727 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.js +856 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +524 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +328 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.js +799 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +180 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.js +72 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.js +434 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.js +298 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.js +675 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1228 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +983 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +254 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +293 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- package/examples/jsm/tsl/display/BloomNode.js +534 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +174 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +365 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.js +572 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +399 -0
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +279 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OutlineNode.js +812 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +768 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +358 -0
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +119 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +767 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +54 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1434 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +403 -0
- package/examples/jsm/webxr/XREstimatedLight.js +254 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/package.json +123 -0
- package/src/Three.Core.js +187 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.js +647 -0
- package/src/Three.WebGPU.Nodes.js +31 -0
- package/src/Three.WebGPU.js +37 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.js +942 -0
- package/src/animation/AnimationClip.js +628 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.js +411 -0
- package/src/animation/AnimationUtils.js +495 -0
- package/src/animation/KeyframeTrack.js +636 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.js +54 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.js +146 -0
- package/src/constants.js +1760 -0
- package/src/core/BufferAttribute.js +1056 -0
- package/src/core/BufferGeometry.js +1458 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.js +291 -0
- package/src/core/InterleavedBufferAttribute.js +549 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.js +1667 -0
- package/src/core/Raycaster.js +262 -0
- package/src/core/RenderTarget.js +392 -0
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.js +180 -0
- package/src/extras/Controls.js +120 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.js +1167 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.js +517 -0
- package/src/extras/core/CurvePath.js +296 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.js +367 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.js +180 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.js +230 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.js +175 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.js +171 -0
- package/src/helpers/AxesHelper.js +96 -0
- package/src/helpers/Box3Helper.js +83 -0
- package/src/helpers/BoxHelper.js +149 -0
- package/src/helpers/CameraHelper.js +345 -0
- package/src/helpers/DirectionalLightHelper.js +148 -0
- package/src/helpers/GridHelper.js +82 -0
- package/src/helpers/HemisphereLightHelper.js +130 -0
- package/src/helpers/PlaneHelper.js +96 -0
- package/src/helpers/PointLightHelper.js +111 -0
- package/src/helpers/PolarGridHelper.js +126 -0
- package/src/helpers/SkeletonHelper.js +194 -0
- package/src/helpers/SpotLightHelper.js +154 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.js +85 -0
- package/src/lights/LightProbe.js +75 -0
- package/src/lights/LightShadow.js +347 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.js +80 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +98 -0
- package/src/loaders/AudioLoader.js +108 -0
- package/src/loaders/BufferGeometryLoader.js +242 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.js +167 -0
- package/src/loaders/CubeTextureLoader.js +103 -0
- package/src/loaders/DataTextureLoader.js +174 -0
- package/src/loaders/FileLoader.js +367 -0
- package/src/loaders/ImageBitmapLoader.js +223 -0
- package/src/loaders/ImageLoader.js +168 -0
- package/src/loaders/Loader.js +222 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.js +329 -0
- package/src/loaders/MaterialLoader.js +439 -0
- package/src/loaders/ObjectLoader.js +1304 -0
- package/src/loaders/TextureLoader.js +74 -0
- package/src/loaders/nodes/NodeLoader.js +194 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.js +122 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.js +1017 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +250 -0
- package/src/materials/MeshDepthMaterial.js +148 -0
- package/src/materials/MeshDistanceMaterial.js +119 -0
- package/src/materials/MeshLambertMaterial.js +402 -0
- package/src/materials/MeshMatcapMaterial.js +245 -0
- package/src/materials/MeshNormalMaterial.js +175 -0
- package/src/materials/MeshPhongMaterial.js +421 -0
- package/src/materials/MeshPhysicalMaterial.js +536 -0
- package/src/materials/MeshStandardMaterial.js +425 -0
- package/src/materials/MeshToonMaterial.js +321 -0
- package/src/materials/PointsMaterial.js +139 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.js +413 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.js +136 -0
- package/src/materials/nodes/Line2NodeMaterial.js +569 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +141 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +521 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +175 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +187 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
- package/src/materials/nodes/NodeMaterial.js +1330 -0
- package/src/materials/nodes/NodeMaterials.js +21 -0
- package/src/materials/nodes/PointsNodeMaterial.js +211 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +186 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +718 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.js +805 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.js +215 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.js +285 -0
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.js +337 -0
- package/src/math/MathUtils.js +751 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.js +617 -0
- package/src/math/Matrix4.js +1314 -0
- package/src/math/Plane.js +368 -0
- package/src/math/Quaternion.js +918 -0
- package/src/math/Ray.js +655 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.js +539 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.js +1067 -0
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.js +173 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +163 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.js +432 -0
- package/src/nodes/accessors/BufferNode.js +128 -0
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +403 -0
- package/src/nodes/accessors/ClippingNode.js +255 -0
- package/src/nodes/accessors/CubeTextureNode.js +215 -0
- package/src/nodes/accessors/InstanceNode.js +349 -0
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +139 -0
- package/src/nodes/accessors/MaterialNode.js +783 -0
- package/src/nodes/accessors/MaterialProperties.js +56 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.js +184 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/MorphNode.js +310 -0
- package/src/nodes/accessors/Normal.js +243 -0
- package/src/nodes/accessors/Object3DNode.js +268 -0
- package/src/nodes/accessors/PointUVNode.js +55 -0
- package/src/nodes/accessors/Position.js +122 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +357 -0
- package/src/nodes/accessors/ReferenceNode.js +424 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +328 -0
- package/src/nodes/accessors/StorageBufferNode.js +405 -0
- package/src/nodes/accessors/StorageTextureNode.js +295 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.js +92 -0
- package/src/nodes/accessors/TextureNode.js +971 -0
- package/src/nodes/accessors/TextureSizeNode.js +77 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.js +350 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.js +224 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.js +181 -0
- package/src/nodes/code/ExpressionNode.js +68 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.js +182 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +202 -0
- package/src/nodes/core/AttributeNode.js +168 -0
- package/src/nodes/core/BypassNode.js +93 -0
- package/src/nodes/core/ConstNode.js +67 -0
- package/src/nodes/core/ContextNode.js +283 -0
- package/src/nodes/core/IndexNode.js +165 -0
- package/src/nodes/core/InputNode.js +136 -0
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.js +196 -0
- package/src/nodes/core/Node.js +1180 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.js +3299 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +314 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.js +408 -0
- package/src/nodes/core/NodeVar.js +60 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.js +105 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.js +367 -0
- package/src/nodes/core/StackNode.js +426 -0
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +134 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +148 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +88 -0
- package/src/nodes/core/UniformGroupNode.js +167 -0
- package/src/nodes/core/UniformNode.js +259 -0
- package/src/nodes/core/VarNode.js +367 -0
- package/src/nodes/core/VaryingNode.js +210 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +117 -0
- package/src/nodes/display/ColorAdjustment.js +158 -0
- package/src/nodes/display/ColorSpaceFunctions.js +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.js +102 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.js +1055 -0
- package/src/nodes/display/RenderOutputNode.js +150 -0
- package/src/nodes/display/ScreenNode.js +292 -0
- package/src/nodes/display/ToneMappingFunctions.js +242 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.js +191 -0
- package/src/nodes/display/ViewportDepthNode.js +342 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/D_GGX.js +23 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.js +175 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.js +878 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +210 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +274 -0
- package/src/nodes/gpgpu/BarrierNode.js +98 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
- package/src/nodes/gpgpu/ComputeNode.js +310 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +234 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.js +309 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.js +178 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.js +49 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.js +73 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.js +115 -0
- package/src/nodes/lighting/LightingNode.js +36 -0
- package/src/nodes/lighting/LightsNode.js +432 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +133 -0
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +889 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +197 -0
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/src/nodes/materialx/lib/mx_noise.js +1491 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +245 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.js +1202 -0
- package/src/nodes/math/MathUtils.js +54 -0
- package/src/nodes/math/OperatorNode.js +752 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.js +397 -0
- package/src/nodes/pmrem/PMREMUtils.js +397 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.js +1250 -0
- package/src/nodes/utils/ArrayElementNode.js +90 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +148 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.js +349 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +33 -0
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +289 -0
- package/src/nodes/utils/ReflectorNode.js +629 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +103 -0
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.js +179 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +63 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.js +1682 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.js +422 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.js +329 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.js +496 -0
- package/src/objects/Points.js +228 -0
- package/src/objects/Skeleton.js +392 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.js +245 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.js +3699 -0
- package/src/renderers/common/Animation.js +159 -0
- package/src/renderers/common/Attributes.js +132 -0
- package/src/renderers/common/Backend.js +769 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +46 -0
- package/src/renderers/common/Binding.js +71 -0
- package/src/renderers/common/Bindings.js +394 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +127 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.js +83 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.js +262 -0
- package/src/renderers/common/Color4.js +77 -0
- package/src/renderers/common/ComputePipeline.js +41 -0
- package/src/renderers/common/Constants.js +15 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/Geometries.js +396 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +501 -0
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +498 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +78 -0
- package/src/renderers/common/QuadMesh.js +112 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +281 -0
- package/src/renderers/common/RenderContexts.js +100 -0
- package/src/renderers/common/RenderList.js +404 -0
- package/src/renderers/common/RenderLists.js +78 -0
- package/src/renderers/common/RenderObject.js +915 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +218 -0
- package/src/renderers/common/RenderPipeline.js +255 -0
- package/src/renderers/common/Renderer.js +3654 -0
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +165 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.js +86 -0
- package/src/renderers/common/Textures.js +629 -0
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +548 -0
- package/src/renderers/common/XRManager.js +1684 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +1042 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +152 -0
- package/src/renderers/common/nodes/NodeLibrary.js +196 -0
- package/src/renderers/common/nodes/NodeManager.js +983 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
- package/src/renderers/common/nodes/NodeSampler.js +62 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +72 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +105 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +125 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +213 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +44 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +216 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +161 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +656 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +376 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.js +272 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.js +362 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.js +666 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.js +150 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.js +186 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.js +584 -0
- package/src/renderers/webgl/WebGLMaterials.js +602 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +1031 -0
- package/src/renderers/webgl/WebGLPrograms.js +679 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +253 -0
- package/src/renderers/webgl/WebGLRenderStates.js +124 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +600 -0
- package/src/renderers/webgl/WebGLState.js +1370 -0
- package/src/renderers/webgl/WebGLTextures.js +2506 -0
- package/src/renderers/webgl/WebGLUniforms.js +1203 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +413 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2783 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1676 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +89 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1361 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1324 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +317 -0
- package/src/renderers/webgpu/WebGPUBackend.js +2602 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +100 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2523 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +187 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +522 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +642 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +846 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +389 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1673 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +269 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.js +1103 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.js +89 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.js +112 -0
- package/src/textures/DataArrayTexture.js +134 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +85 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +230 -0
- package/src/textures/Texture.js +812 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,1314 @@
|
|
|
1
|
+
import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from '../constants.js';
|
|
2
|
+
import { Vector3 } from './Vector3.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a 4x4 matrix.
|
|
6
|
+
*
|
|
7
|
+
* The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
|
|
8
|
+
* For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices)
|
|
9
|
+
*
|
|
10
|
+
* This allows a 3D vector representing a point in 3D space to undergo
|
|
11
|
+
* transformations such as translation, rotation, shear, scale, reflection,
|
|
12
|
+
* orthogonal or perspective projection and so on, by being multiplied by the
|
|
13
|
+
* matrix. This is known as `applying` the matrix to the vector.
|
|
14
|
+
*
|
|
15
|
+
* A Note on Row-Major and Column-Major Ordering:
|
|
16
|
+
*
|
|
17
|
+
* The constructor and {@link Matrix3#set} method take arguments in
|
|
18
|
+
* [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
19
|
+
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
20
|
+
* This means that calling:
|
|
21
|
+
* ```js
|
|
22
|
+
* const m = new THREE.Matrix4();
|
|
23
|
+
* m.set( 11, 12, 13, 14,
|
|
24
|
+
* 21, 22, 23, 24,
|
|
25
|
+
* 31, 32, 33, 34,
|
|
26
|
+
* 41, 42, 43, 44 );
|
|
27
|
+
* ```
|
|
28
|
+
* will result in the elements array containing:
|
|
29
|
+
* ```js
|
|
30
|
+
* m.elements = [ 11, 21, 31, 41,
|
|
31
|
+
* 12, 22, 32, 42,
|
|
32
|
+
* 13, 23, 33, 43,
|
|
33
|
+
* 14, 24, 34, 44 ];
|
|
34
|
+
* ```
|
|
35
|
+
* and internally all calculations are performed using column-major ordering.
|
|
36
|
+
* However, as the actual ordering makes no difference mathematically and
|
|
37
|
+
* most people are used to thinking about matrices in row-major order, the
|
|
38
|
+
* three.js documentation shows matrices in row-major order. Just bear in
|
|
39
|
+
* mind that if you are reading the source code, you'll have to take the
|
|
40
|
+
* transpose of any matrices outlined here to make sense of the calculations.
|
|
41
|
+
*/
|
|
42
|
+
class Matrix4 {
|
|
43
|
+
|
|
44
|
+
static {
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* This flag can be used for type testing.
|
|
48
|
+
*
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
* @readonly
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
Matrix4.prototype.isMatrix4 = true;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
59
|
+
* in row-major order. If no arguments are provided, the constructor
|
|
60
|
+
* initializes the matrix as an identity matrix.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} [n11] - 1-1 matrix element.
|
|
63
|
+
* @param {number} [n12] - 1-2 matrix element.
|
|
64
|
+
* @param {number} [n13] - 1-3 matrix element.
|
|
65
|
+
* @param {number} [n14] - 1-4 matrix element.
|
|
66
|
+
* @param {number} [n21] - 2-1 matrix element.
|
|
67
|
+
* @param {number} [n22] - 2-2 matrix element.
|
|
68
|
+
* @param {number} [n23] - 2-3 matrix element.
|
|
69
|
+
* @param {number} [n24] - 2-4 matrix element.
|
|
70
|
+
* @param {number} [n31] - 3-1 matrix element.
|
|
71
|
+
* @param {number} [n32] - 3-2 matrix element.
|
|
72
|
+
* @param {number} [n33] - 3-3 matrix element.
|
|
73
|
+
* @param {number} [n34] - 3-4 matrix element.
|
|
74
|
+
* @param {number} [n41] - 4-1 matrix element.
|
|
75
|
+
* @param {number} [n42] - 4-2 matrix element.
|
|
76
|
+
* @param {number} [n43] - 4-3 matrix element.
|
|
77
|
+
* @param {number} [n44] - 4-4 matrix element.
|
|
78
|
+
*/
|
|
79
|
+
constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A column-major list of matrix values.
|
|
83
|
+
*
|
|
84
|
+
* @type {Array<number>}
|
|
85
|
+
*/
|
|
86
|
+
this.elements = [
|
|
87
|
+
|
|
88
|
+
1, 0, 0, 0,
|
|
89
|
+
0, 1, 0, 0,
|
|
90
|
+
0, 0, 1, 0,
|
|
91
|
+
0, 0, 0, 1
|
|
92
|
+
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
if ( n11 !== undefined ) {
|
|
96
|
+
|
|
97
|
+
this.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Sets the elements of the matrix.The arguments are supposed to be
|
|
105
|
+
* in row-major order.
|
|
106
|
+
*
|
|
107
|
+
* @param {number} [n11] - 1-1 matrix element.
|
|
108
|
+
* @param {number} [n12] - 1-2 matrix element.
|
|
109
|
+
* @param {number} [n13] - 1-3 matrix element.
|
|
110
|
+
* @param {number} [n14] - 1-4 matrix element.
|
|
111
|
+
* @param {number} [n21] - 2-1 matrix element.
|
|
112
|
+
* @param {number} [n22] - 2-2 matrix element.
|
|
113
|
+
* @param {number} [n23] - 2-3 matrix element.
|
|
114
|
+
* @param {number} [n24] - 2-4 matrix element.
|
|
115
|
+
* @param {number} [n31] - 3-1 matrix element.
|
|
116
|
+
* @param {number} [n32] - 3-2 matrix element.
|
|
117
|
+
* @param {number} [n33] - 3-3 matrix element.
|
|
118
|
+
* @param {number} [n34] - 3-4 matrix element.
|
|
119
|
+
* @param {number} [n41] - 4-1 matrix element.
|
|
120
|
+
* @param {number} [n42] - 4-2 matrix element.
|
|
121
|
+
* @param {number} [n43] - 4-3 matrix element.
|
|
122
|
+
* @param {number} [n44] - 4-4 matrix element.
|
|
123
|
+
* @return {Matrix4} A reference to this matrix.
|
|
124
|
+
*/
|
|
125
|
+
set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
126
|
+
|
|
127
|
+
const te = this.elements;
|
|
128
|
+
|
|
129
|
+
te[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;
|
|
130
|
+
te[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;
|
|
131
|
+
te[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;
|
|
132
|
+
te[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;
|
|
133
|
+
|
|
134
|
+
return this;
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Sets this matrix to the 4x4 identity matrix.
|
|
140
|
+
*
|
|
141
|
+
* @return {Matrix4} A reference to this matrix.
|
|
142
|
+
*/
|
|
143
|
+
identity() {
|
|
144
|
+
|
|
145
|
+
this.set(
|
|
146
|
+
|
|
147
|
+
1, 0, 0, 0,
|
|
148
|
+
0, 1, 0, 0,
|
|
149
|
+
0, 0, 1, 0,
|
|
150
|
+
0, 0, 0, 1
|
|
151
|
+
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
return this;
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Returns a matrix with copied values from this instance.
|
|
160
|
+
*
|
|
161
|
+
* @return {Matrix4} A clone of this instance.
|
|
162
|
+
*/
|
|
163
|
+
clone() {
|
|
164
|
+
|
|
165
|
+
return new Matrix4().fromArray( this.elements );
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Copies the values of the given matrix to this instance.
|
|
171
|
+
*
|
|
172
|
+
* @param {Matrix4} m - The matrix to copy.
|
|
173
|
+
* @return {Matrix4} A reference to this matrix.
|
|
174
|
+
*/
|
|
175
|
+
copy( m ) {
|
|
176
|
+
|
|
177
|
+
const te = this.elements;
|
|
178
|
+
const me = m.elements;
|
|
179
|
+
|
|
180
|
+
te[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];
|
|
181
|
+
te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];
|
|
182
|
+
te[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];
|
|
183
|
+
te[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];
|
|
184
|
+
|
|
185
|
+
return this;
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Copies the translation component of the given matrix
|
|
191
|
+
* into this matrix's translation component.
|
|
192
|
+
*
|
|
193
|
+
* @param {Matrix4} m - The matrix to copy the translation component.
|
|
194
|
+
* @return {Matrix4} A reference to this matrix.
|
|
195
|
+
*/
|
|
196
|
+
copyPosition( m ) {
|
|
197
|
+
|
|
198
|
+
const te = this.elements, me = m.elements;
|
|
199
|
+
|
|
200
|
+
te[ 12 ] = me[ 12 ];
|
|
201
|
+
te[ 13 ] = me[ 13 ];
|
|
202
|
+
te[ 14 ] = me[ 14 ];
|
|
203
|
+
|
|
204
|
+
return this;
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix.
|
|
210
|
+
*
|
|
211
|
+
* @param {Matrix3} m - The 3x3 matrix.
|
|
212
|
+
* @return {Matrix4} A reference to this matrix.
|
|
213
|
+
*/
|
|
214
|
+
setFromMatrix3( m ) {
|
|
215
|
+
|
|
216
|
+
const me = m.elements;
|
|
217
|
+
|
|
218
|
+
this.set(
|
|
219
|
+
|
|
220
|
+
me[ 0 ], me[ 3 ], me[ 6 ], 0,
|
|
221
|
+
me[ 1 ], me[ 4 ], me[ 7 ], 0,
|
|
222
|
+
me[ 2 ], me[ 5 ], me[ 8 ], 0,
|
|
223
|
+
0, 0, 0, 1
|
|
224
|
+
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
return this;
|
|
228
|
+
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Extracts the basis of this matrix into the three axis vectors provided.
|
|
233
|
+
*
|
|
234
|
+
* @param {Vector3} xAxis - The basis's x axis.
|
|
235
|
+
* @param {Vector3} yAxis - The basis's y axis.
|
|
236
|
+
* @param {Vector3} zAxis - The basis's z axis.
|
|
237
|
+
* @return {Matrix4} A reference to this matrix.
|
|
238
|
+
*/
|
|
239
|
+
extractBasis( xAxis, yAxis, zAxis ) {
|
|
240
|
+
|
|
241
|
+
if ( this.determinant() === 0 ) {
|
|
242
|
+
|
|
243
|
+
xAxis.set( 1, 0, 0 );
|
|
244
|
+
yAxis.set( 0, 1, 0 );
|
|
245
|
+
zAxis.set( 0, 0, 1 );
|
|
246
|
+
|
|
247
|
+
return this;
|
|
248
|
+
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
xAxis.setFromMatrixColumn( this, 0 );
|
|
252
|
+
yAxis.setFromMatrixColumn( this, 1 );
|
|
253
|
+
zAxis.setFromMatrixColumn( this, 2 );
|
|
254
|
+
|
|
255
|
+
return this;
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Sets the given basis vectors to this matrix.
|
|
261
|
+
*
|
|
262
|
+
* @param {Vector3} xAxis - The basis's x axis.
|
|
263
|
+
* @param {Vector3} yAxis - The basis's y axis.
|
|
264
|
+
* @param {Vector3} zAxis - The basis's z axis.
|
|
265
|
+
* @return {Matrix4} A reference to this matrix.
|
|
266
|
+
*/
|
|
267
|
+
makeBasis( xAxis, yAxis, zAxis ) {
|
|
268
|
+
|
|
269
|
+
this.set(
|
|
270
|
+
xAxis.x, yAxis.x, zAxis.x, 0,
|
|
271
|
+
xAxis.y, yAxis.y, zAxis.y, 0,
|
|
272
|
+
xAxis.z, yAxis.z, zAxis.z, 0,
|
|
273
|
+
0, 0, 0, 1
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
return this;
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Extracts the rotation component of the given matrix
|
|
282
|
+
* into this matrix's rotation component.
|
|
283
|
+
*
|
|
284
|
+
* Note: This method does not support reflection matrices.
|
|
285
|
+
*
|
|
286
|
+
* @param {Matrix4} m - The matrix.
|
|
287
|
+
* @return {Matrix4} A reference to this matrix.
|
|
288
|
+
*/
|
|
289
|
+
extractRotation( m ) {
|
|
290
|
+
|
|
291
|
+
if ( m.determinant() === 0 ) {
|
|
292
|
+
|
|
293
|
+
return this.identity();
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const te = this.elements;
|
|
298
|
+
const me = m.elements;
|
|
299
|
+
|
|
300
|
+
const scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();
|
|
301
|
+
const scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();
|
|
302
|
+
const scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();
|
|
303
|
+
|
|
304
|
+
te[ 0 ] = me[ 0 ] * scaleX;
|
|
305
|
+
te[ 1 ] = me[ 1 ] * scaleX;
|
|
306
|
+
te[ 2 ] = me[ 2 ] * scaleX;
|
|
307
|
+
te[ 3 ] = 0;
|
|
308
|
+
|
|
309
|
+
te[ 4 ] = me[ 4 ] * scaleY;
|
|
310
|
+
te[ 5 ] = me[ 5 ] * scaleY;
|
|
311
|
+
te[ 6 ] = me[ 6 ] * scaleY;
|
|
312
|
+
te[ 7 ] = 0;
|
|
313
|
+
|
|
314
|
+
te[ 8 ] = me[ 8 ] * scaleZ;
|
|
315
|
+
te[ 9 ] = me[ 9 ] * scaleZ;
|
|
316
|
+
te[ 10 ] = me[ 10 ] * scaleZ;
|
|
317
|
+
te[ 11 ] = 0;
|
|
318
|
+
|
|
319
|
+
te[ 12 ] = 0;
|
|
320
|
+
te[ 13 ] = 0;
|
|
321
|
+
te[ 14 ] = 0;
|
|
322
|
+
te[ 15 ] = 1;
|
|
323
|
+
|
|
324
|
+
return this;
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Sets the rotation component (the upper left 3x3 matrix) of this matrix to
|
|
330
|
+
* the rotation specified by the given Euler angles. The rest of
|
|
331
|
+
* the matrix is set to the identity. Depending on the {@link Euler#order},
|
|
332
|
+
* there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)
|
|
333
|
+
* for a complete list.
|
|
334
|
+
*
|
|
335
|
+
* @param {Euler} euler - The Euler angles.
|
|
336
|
+
* @return {Matrix4} A reference to this matrix.
|
|
337
|
+
*/
|
|
338
|
+
makeRotationFromEuler( euler ) {
|
|
339
|
+
|
|
340
|
+
const te = this.elements;
|
|
341
|
+
|
|
342
|
+
const x = euler.x, y = euler.y, z = euler.z;
|
|
343
|
+
const a = Math.cos( x ), b = Math.sin( x );
|
|
344
|
+
const c = Math.cos( y ), d = Math.sin( y );
|
|
345
|
+
const e = Math.cos( z ), f = Math.sin( z );
|
|
346
|
+
|
|
347
|
+
if ( euler.order === 'XYZ' ) {
|
|
348
|
+
|
|
349
|
+
const ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
350
|
+
|
|
351
|
+
te[ 0 ] = c * e;
|
|
352
|
+
te[ 4 ] = - c * f;
|
|
353
|
+
te[ 8 ] = d;
|
|
354
|
+
|
|
355
|
+
te[ 1 ] = af + be * d;
|
|
356
|
+
te[ 5 ] = ae - bf * d;
|
|
357
|
+
te[ 9 ] = - b * c;
|
|
358
|
+
|
|
359
|
+
te[ 2 ] = bf - ae * d;
|
|
360
|
+
te[ 6 ] = be + af * d;
|
|
361
|
+
te[ 10 ] = a * c;
|
|
362
|
+
|
|
363
|
+
} else if ( euler.order === 'YXZ' ) {
|
|
364
|
+
|
|
365
|
+
const ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
366
|
+
|
|
367
|
+
te[ 0 ] = ce + df * b;
|
|
368
|
+
te[ 4 ] = de * b - cf;
|
|
369
|
+
te[ 8 ] = a * d;
|
|
370
|
+
|
|
371
|
+
te[ 1 ] = a * f;
|
|
372
|
+
te[ 5 ] = a * e;
|
|
373
|
+
te[ 9 ] = - b;
|
|
374
|
+
|
|
375
|
+
te[ 2 ] = cf * b - de;
|
|
376
|
+
te[ 6 ] = df + ce * b;
|
|
377
|
+
te[ 10 ] = a * c;
|
|
378
|
+
|
|
379
|
+
} else if ( euler.order === 'ZXY' ) {
|
|
380
|
+
|
|
381
|
+
const ce = c * e, cf = c * f, de = d * e, df = d * f;
|
|
382
|
+
|
|
383
|
+
te[ 0 ] = ce - df * b;
|
|
384
|
+
te[ 4 ] = - a * f;
|
|
385
|
+
te[ 8 ] = de + cf * b;
|
|
386
|
+
|
|
387
|
+
te[ 1 ] = cf + de * b;
|
|
388
|
+
te[ 5 ] = a * e;
|
|
389
|
+
te[ 9 ] = df - ce * b;
|
|
390
|
+
|
|
391
|
+
te[ 2 ] = - a * d;
|
|
392
|
+
te[ 6 ] = b;
|
|
393
|
+
te[ 10 ] = a * c;
|
|
394
|
+
|
|
395
|
+
} else if ( euler.order === 'ZYX' ) {
|
|
396
|
+
|
|
397
|
+
const ae = a * e, af = a * f, be = b * e, bf = b * f;
|
|
398
|
+
|
|
399
|
+
te[ 0 ] = c * e;
|
|
400
|
+
te[ 4 ] = be * d - af;
|
|
401
|
+
te[ 8 ] = ae * d + bf;
|
|
402
|
+
|
|
403
|
+
te[ 1 ] = c * f;
|
|
404
|
+
te[ 5 ] = bf * d + ae;
|
|
405
|
+
te[ 9 ] = af * d - be;
|
|
406
|
+
|
|
407
|
+
te[ 2 ] = - d;
|
|
408
|
+
te[ 6 ] = b * c;
|
|
409
|
+
te[ 10 ] = a * c;
|
|
410
|
+
|
|
411
|
+
} else if ( euler.order === 'YZX' ) {
|
|
412
|
+
|
|
413
|
+
const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
414
|
+
|
|
415
|
+
te[ 0 ] = c * e;
|
|
416
|
+
te[ 4 ] = bd - ac * f;
|
|
417
|
+
te[ 8 ] = bc * f + ad;
|
|
418
|
+
|
|
419
|
+
te[ 1 ] = f;
|
|
420
|
+
te[ 5 ] = a * e;
|
|
421
|
+
te[ 9 ] = - b * e;
|
|
422
|
+
|
|
423
|
+
te[ 2 ] = - d * e;
|
|
424
|
+
te[ 6 ] = ad * f + bc;
|
|
425
|
+
te[ 10 ] = ac - bd * f;
|
|
426
|
+
|
|
427
|
+
} else if ( euler.order === 'XZY' ) {
|
|
428
|
+
|
|
429
|
+
const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
|
|
430
|
+
|
|
431
|
+
te[ 0 ] = c * e;
|
|
432
|
+
te[ 4 ] = - f;
|
|
433
|
+
te[ 8 ] = d * e;
|
|
434
|
+
|
|
435
|
+
te[ 1 ] = ac * f + bd;
|
|
436
|
+
te[ 5 ] = a * e;
|
|
437
|
+
te[ 9 ] = ad * f - bc;
|
|
438
|
+
|
|
439
|
+
te[ 2 ] = bc * f - ad;
|
|
440
|
+
te[ 6 ] = b * e;
|
|
441
|
+
te[ 10 ] = bd * f + ac;
|
|
442
|
+
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// bottom row
|
|
446
|
+
te[ 3 ] = 0;
|
|
447
|
+
te[ 7 ] = 0;
|
|
448
|
+
te[ 11 ] = 0;
|
|
449
|
+
|
|
450
|
+
// last column
|
|
451
|
+
te[ 12 ] = 0;
|
|
452
|
+
te[ 13 ] = 0;
|
|
453
|
+
te[ 14 ] = 0;
|
|
454
|
+
te[ 15 ] = 1;
|
|
455
|
+
|
|
456
|
+
return this;
|
|
457
|
+
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Sets the rotation component of this matrix to the rotation specified by
|
|
462
|
+
* the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)
|
|
463
|
+
* The rest of the matrix is set to the identity.
|
|
464
|
+
*
|
|
465
|
+
* @param {Quaternion} q - The Quaternion.
|
|
466
|
+
* @return {Matrix4} A reference to this matrix.
|
|
467
|
+
*/
|
|
468
|
+
makeRotationFromQuaternion( q ) {
|
|
469
|
+
|
|
470
|
+
return this.compose( _zero, q, _one );
|
|
471
|
+
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Sets the rotation component of the transformation matrix, looking from `eye` towards
|
|
476
|
+
* `target`, and oriented by the up-direction.
|
|
477
|
+
*
|
|
478
|
+
* @param {Vector3} eye - The eye vector.
|
|
479
|
+
* @param {Vector3} target - The target vector.
|
|
480
|
+
* @param {Vector3} up - The up vector.
|
|
481
|
+
* @return {Matrix4} A reference to this matrix.
|
|
482
|
+
*/
|
|
483
|
+
lookAt( eye, target, up ) {
|
|
484
|
+
|
|
485
|
+
const te = this.elements;
|
|
486
|
+
|
|
487
|
+
_z.subVectors( eye, target );
|
|
488
|
+
|
|
489
|
+
if ( _z.lengthSq() === 0 ) {
|
|
490
|
+
|
|
491
|
+
// eye and target are in the same position
|
|
492
|
+
|
|
493
|
+
_z.z = 1;
|
|
494
|
+
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
_z.normalize();
|
|
498
|
+
_x.crossVectors( up, _z );
|
|
499
|
+
|
|
500
|
+
if ( _x.lengthSq() === 0 ) {
|
|
501
|
+
|
|
502
|
+
// up and z are parallel
|
|
503
|
+
|
|
504
|
+
if ( Math.abs( up.z ) === 1 ) {
|
|
505
|
+
|
|
506
|
+
_z.x += 0.0001;
|
|
507
|
+
|
|
508
|
+
} else {
|
|
509
|
+
|
|
510
|
+
_z.z += 0.0001;
|
|
511
|
+
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
_z.normalize();
|
|
515
|
+
_x.crossVectors( up, _z );
|
|
516
|
+
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
_x.normalize();
|
|
520
|
+
_y.crossVectors( _z, _x );
|
|
521
|
+
|
|
522
|
+
te[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;
|
|
523
|
+
te[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;
|
|
524
|
+
te[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;
|
|
525
|
+
|
|
526
|
+
return this;
|
|
527
|
+
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Post-multiplies this matrix by the given 4x4 matrix.
|
|
532
|
+
*
|
|
533
|
+
* @param {Matrix4} m - The matrix to multiply with.
|
|
534
|
+
* @return {Matrix4} A reference to this matrix.
|
|
535
|
+
*/
|
|
536
|
+
multiply( m ) {
|
|
537
|
+
|
|
538
|
+
return this.multiplyMatrices( this, m );
|
|
539
|
+
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Pre-multiplies this matrix by the given 4x4 matrix.
|
|
544
|
+
*
|
|
545
|
+
* @param {Matrix4} m - The matrix to multiply with.
|
|
546
|
+
* @return {Matrix4} A reference to this matrix.
|
|
547
|
+
*/
|
|
548
|
+
premultiply( m ) {
|
|
549
|
+
|
|
550
|
+
return this.multiplyMatrices( m, this );
|
|
551
|
+
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Multiples the given 4x4 matrices and stores the result
|
|
556
|
+
* in this matrix.
|
|
557
|
+
*
|
|
558
|
+
* @param {Matrix4} a - The first matrix.
|
|
559
|
+
* @param {Matrix4} b - The second matrix.
|
|
560
|
+
* @return {Matrix4} A reference to this matrix.
|
|
561
|
+
*/
|
|
562
|
+
multiplyMatrices( a, b ) {
|
|
563
|
+
|
|
564
|
+
const ae = a.elements;
|
|
565
|
+
const be = b.elements;
|
|
566
|
+
const te = this.elements;
|
|
567
|
+
|
|
568
|
+
const a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];
|
|
569
|
+
const a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];
|
|
570
|
+
const a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];
|
|
571
|
+
const a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];
|
|
572
|
+
|
|
573
|
+
const b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];
|
|
574
|
+
const b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];
|
|
575
|
+
const b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];
|
|
576
|
+
const b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];
|
|
577
|
+
|
|
578
|
+
te[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
|
|
579
|
+
te[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
|
|
580
|
+
te[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
|
|
581
|
+
te[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
|
|
582
|
+
|
|
583
|
+
te[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
|
|
584
|
+
te[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
|
|
585
|
+
te[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
|
|
586
|
+
te[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
|
|
587
|
+
|
|
588
|
+
te[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
|
|
589
|
+
te[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
|
|
590
|
+
te[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
|
|
591
|
+
te[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
|
|
592
|
+
|
|
593
|
+
te[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
|
|
594
|
+
te[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
|
|
595
|
+
te[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
|
|
596
|
+
te[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
|
|
597
|
+
|
|
598
|
+
return this;
|
|
599
|
+
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Multiplies every component of the matrix by the given scalar.
|
|
604
|
+
*
|
|
605
|
+
* @param {number} s - The scalar.
|
|
606
|
+
* @return {Matrix4} A reference to this matrix.
|
|
607
|
+
*/
|
|
608
|
+
multiplyScalar( s ) {
|
|
609
|
+
|
|
610
|
+
const te = this.elements;
|
|
611
|
+
|
|
612
|
+
te[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;
|
|
613
|
+
te[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;
|
|
614
|
+
te[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;
|
|
615
|
+
te[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;
|
|
616
|
+
|
|
617
|
+
return this;
|
|
618
|
+
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Computes and returns the determinant of this matrix.
|
|
623
|
+
*
|
|
624
|
+
* Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
|
|
625
|
+
*
|
|
626
|
+
* @return {number} The determinant.
|
|
627
|
+
*/
|
|
628
|
+
determinant() {
|
|
629
|
+
|
|
630
|
+
const te = this.elements;
|
|
631
|
+
|
|
632
|
+
const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];
|
|
633
|
+
const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];
|
|
634
|
+
const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];
|
|
635
|
+
const n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];
|
|
636
|
+
|
|
637
|
+
const t11 = n23 * n34 - n24 * n33;
|
|
638
|
+
const t12 = n22 * n34 - n24 * n32;
|
|
639
|
+
const t13 = n22 * n33 - n23 * n32;
|
|
640
|
+
|
|
641
|
+
const t21 = n21 * n34 - n24 * n31;
|
|
642
|
+
const t22 = n21 * n33 - n23 * n31;
|
|
643
|
+
const t23 = n21 * n32 - n22 * n31;
|
|
644
|
+
|
|
645
|
+
return n11 * ( n42 * t11 - n43 * t12 + n44 * t13 ) -
|
|
646
|
+
n12 * ( n41 * t11 - n43 * t21 + n44 * t22 ) +
|
|
647
|
+
n13 * ( n41 * t12 - n42 * t21 + n44 * t23 ) -
|
|
648
|
+
n14 * ( n41 * t13 - n42 * t22 + n43 * t23 );
|
|
649
|
+
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Transposes this matrix in place.
|
|
654
|
+
*
|
|
655
|
+
* @return {Matrix4} A reference to this matrix.
|
|
656
|
+
*/
|
|
657
|
+
transpose() {
|
|
658
|
+
|
|
659
|
+
const te = this.elements;
|
|
660
|
+
let tmp;
|
|
661
|
+
|
|
662
|
+
tmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;
|
|
663
|
+
tmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;
|
|
664
|
+
tmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;
|
|
665
|
+
|
|
666
|
+
tmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;
|
|
667
|
+
tmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;
|
|
668
|
+
tmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;
|
|
669
|
+
|
|
670
|
+
return this;
|
|
671
|
+
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Sets the position component for this matrix from the given vector,
|
|
676
|
+
* without affecting the rest of the matrix.
|
|
677
|
+
*
|
|
678
|
+
* @param {number|Vector3} x - The x component of the vector or alternatively the vector object.
|
|
679
|
+
* @param {number} y - The y component of the vector.
|
|
680
|
+
* @param {number} z - The z component of the vector.
|
|
681
|
+
* @return {Matrix4} A reference to this matrix.
|
|
682
|
+
*/
|
|
683
|
+
setPosition( x, y, z ) {
|
|
684
|
+
|
|
685
|
+
const te = this.elements;
|
|
686
|
+
|
|
687
|
+
if ( x.isVector3 ) {
|
|
688
|
+
|
|
689
|
+
te[ 12 ] = x.x;
|
|
690
|
+
te[ 13 ] = x.y;
|
|
691
|
+
te[ 14 ] = x.z;
|
|
692
|
+
|
|
693
|
+
} else {
|
|
694
|
+
|
|
695
|
+
te[ 12 ] = x;
|
|
696
|
+
te[ 13 ] = y;
|
|
697
|
+
te[ 14 ] = z;
|
|
698
|
+
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return this;
|
|
702
|
+
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
707
|
+
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
708
|
+
* a zero matrix instead.
|
|
709
|
+
*
|
|
710
|
+
* @return {Matrix4} A reference to this matrix.
|
|
711
|
+
*/
|
|
712
|
+
invert() {
|
|
713
|
+
|
|
714
|
+
// based on https://github.com/toji/gl-matrix
|
|
715
|
+
const te = this.elements,
|
|
716
|
+
|
|
717
|
+
n11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],
|
|
718
|
+
n12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],
|
|
719
|
+
n13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],
|
|
720
|
+
n14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],
|
|
721
|
+
|
|
722
|
+
t1 = n11 * n22 - n21 * n12,
|
|
723
|
+
t2 = n11 * n32 - n31 * n12,
|
|
724
|
+
t3 = n11 * n42 - n41 * n12,
|
|
725
|
+
t4 = n21 * n32 - n31 * n22,
|
|
726
|
+
t5 = n21 * n42 - n41 * n22,
|
|
727
|
+
t6 = n31 * n42 - n41 * n32,
|
|
728
|
+
t7 = n13 * n24 - n23 * n14,
|
|
729
|
+
t8 = n13 * n34 - n33 * n14,
|
|
730
|
+
t9 = n13 * n44 - n43 * n14,
|
|
731
|
+
t10 = n23 * n34 - n33 * n24,
|
|
732
|
+
t11 = n23 * n44 - n43 * n24,
|
|
733
|
+
t12 = n33 * n44 - n43 * n34;
|
|
734
|
+
|
|
735
|
+
const det = t1 * t12 - t2 * t11 + t3 * t10 + t4 * t9 - t5 * t8 + t6 * t7;
|
|
736
|
+
|
|
737
|
+
if ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
|
|
738
|
+
|
|
739
|
+
const detInv = 1 / det;
|
|
740
|
+
|
|
741
|
+
te[ 0 ] = ( n22 * t12 - n32 * t11 + n42 * t10 ) * detInv;
|
|
742
|
+
te[ 1 ] = ( n31 * t11 - n21 * t12 - n41 * t10 ) * detInv;
|
|
743
|
+
te[ 2 ] = ( n24 * t6 - n34 * t5 + n44 * t4 ) * detInv;
|
|
744
|
+
te[ 3 ] = ( n33 * t5 - n23 * t6 - n43 * t4 ) * detInv;
|
|
745
|
+
|
|
746
|
+
te[ 4 ] = ( n32 * t9 - n12 * t12 - n42 * t8 ) * detInv;
|
|
747
|
+
te[ 5 ] = ( n11 * t12 - n31 * t9 + n41 * t8 ) * detInv;
|
|
748
|
+
te[ 6 ] = ( n34 * t3 - n14 * t6 - n44 * t2 ) * detInv;
|
|
749
|
+
te[ 7 ] = ( n13 * t6 - n33 * t3 + n43 * t2 ) * detInv;
|
|
750
|
+
|
|
751
|
+
te[ 8 ] = ( n12 * t11 - n22 * t9 + n42 * t7 ) * detInv;
|
|
752
|
+
te[ 9 ] = ( n21 * t9 - n11 * t11 - n41 * t7 ) * detInv;
|
|
753
|
+
te[ 10 ] = ( n14 * t5 - n24 * t3 + n44 * t1 ) * detInv;
|
|
754
|
+
te[ 11 ] = ( n23 * t3 - n13 * t5 - n43 * t1 ) * detInv;
|
|
755
|
+
|
|
756
|
+
te[ 12 ] = ( n22 * t8 - n12 * t10 - n32 * t7 ) * detInv;
|
|
757
|
+
te[ 13 ] = ( n11 * t10 - n21 * t8 + n31 * t7 ) * detInv;
|
|
758
|
+
te[ 14 ] = ( n24 * t2 - n14 * t4 - n34 * t1 ) * detInv;
|
|
759
|
+
te[ 15 ] = ( n13 * t4 - n23 * t2 + n33 * t1 ) * detInv;
|
|
760
|
+
|
|
761
|
+
return this;
|
|
762
|
+
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Multiplies the columns of this matrix by the given vector.
|
|
767
|
+
*
|
|
768
|
+
* @param {Vector3} v - The scale vector.
|
|
769
|
+
* @return {Matrix4} A reference to this matrix.
|
|
770
|
+
*/
|
|
771
|
+
scale( v ) {
|
|
772
|
+
|
|
773
|
+
const te = this.elements;
|
|
774
|
+
const x = v.x, y = v.y, z = v.z;
|
|
775
|
+
|
|
776
|
+
te[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;
|
|
777
|
+
te[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;
|
|
778
|
+
te[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;
|
|
779
|
+
te[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;
|
|
780
|
+
|
|
781
|
+
return this;
|
|
782
|
+
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Gets the maximum scale value of the three axes.
|
|
787
|
+
*
|
|
788
|
+
* @return {number} The maximum scale.
|
|
789
|
+
*/
|
|
790
|
+
getMaxScaleOnAxis() {
|
|
791
|
+
|
|
792
|
+
const te = this.elements;
|
|
793
|
+
|
|
794
|
+
const scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];
|
|
795
|
+
const scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];
|
|
796
|
+
const scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];
|
|
797
|
+
|
|
798
|
+
return Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );
|
|
799
|
+
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Sets this matrix as a translation transform from the given vector.
|
|
804
|
+
*
|
|
805
|
+
* @param {number|Vector3} x - The amount to translate in the X axis or alternatively a translation vector.
|
|
806
|
+
* @param {number} y - The amount to translate in the Y axis.
|
|
807
|
+
* @param {number} z - The amount to translate in the z axis.
|
|
808
|
+
* @return {Matrix4} A reference to this matrix.
|
|
809
|
+
*/
|
|
810
|
+
makeTranslation( x, y, z ) {
|
|
811
|
+
|
|
812
|
+
if ( x.isVector3 ) {
|
|
813
|
+
|
|
814
|
+
this.set(
|
|
815
|
+
|
|
816
|
+
1, 0, 0, x.x,
|
|
817
|
+
0, 1, 0, x.y,
|
|
818
|
+
0, 0, 1, x.z,
|
|
819
|
+
0, 0, 0, 1
|
|
820
|
+
|
|
821
|
+
);
|
|
822
|
+
|
|
823
|
+
} else {
|
|
824
|
+
|
|
825
|
+
this.set(
|
|
826
|
+
|
|
827
|
+
1, 0, 0, x,
|
|
828
|
+
0, 1, 0, y,
|
|
829
|
+
0, 0, 1, z,
|
|
830
|
+
0, 0, 0, 1
|
|
831
|
+
|
|
832
|
+
);
|
|
833
|
+
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
return this;
|
|
837
|
+
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Sets this matrix as a rotational transformation around the X axis by
|
|
842
|
+
* the given angle.
|
|
843
|
+
*
|
|
844
|
+
* @param {number} theta - The rotation in radians.
|
|
845
|
+
* @return {Matrix4} A reference to this matrix.
|
|
846
|
+
*/
|
|
847
|
+
makeRotationX( theta ) {
|
|
848
|
+
|
|
849
|
+
const c = Math.cos( theta ), s = Math.sin( theta );
|
|
850
|
+
|
|
851
|
+
this.set(
|
|
852
|
+
|
|
853
|
+
1, 0, 0, 0,
|
|
854
|
+
0, c, - s, 0,
|
|
855
|
+
0, s, c, 0,
|
|
856
|
+
0, 0, 0, 1
|
|
857
|
+
|
|
858
|
+
);
|
|
859
|
+
|
|
860
|
+
return this;
|
|
861
|
+
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Sets this matrix as a rotational transformation around the Y axis by
|
|
866
|
+
* the given angle.
|
|
867
|
+
*
|
|
868
|
+
* @param {number} theta - The rotation in radians.
|
|
869
|
+
* @return {Matrix4} A reference to this matrix.
|
|
870
|
+
*/
|
|
871
|
+
makeRotationY( theta ) {
|
|
872
|
+
|
|
873
|
+
const c = Math.cos( theta ), s = Math.sin( theta );
|
|
874
|
+
|
|
875
|
+
this.set(
|
|
876
|
+
|
|
877
|
+
c, 0, s, 0,
|
|
878
|
+
0, 1, 0, 0,
|
|
879
|
+
- s, 0, c, 0,
|
|
880
|
+
0, 0, 0, 1
|
|
881
|
+
|
|
882
|
+
);
|
|
883
|
+
|
|
884
|
+
return this;
|
|
885
|
+
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Sets this matrix as a rotational transformation around the Z axis by
|
|
890
|
+
* the given angle.
|
|
891
|
+
*
|
|
892
|
+
* @param {number} theta - The rotation in radians.
|
|
893
|
+
* @return {Matrix4} A reference to this matrix.
|
|
894
|
+
*/
|
|
895
|
+
makeRotationZ( theta ) {
|
|
896
|
+
|
|
897
|
+
const c = Math.cos( theta ), s = Math.sin( theta );
|
|
898
|
+
|
|
899
|
+
this.set(
|
|
900
|
+
|
|
901
|
+
c, - s, 0, 0,
|
|
902
|
+
s, c, 0, 0,
|
|
903
|
+
0, 0, 1, 0,
|
|
904
|
+
0, 0, 0, 1
|
|
905
|
+
|
|
906
|
+
);
|
|
907
|
+
|
|
908
|
+
return this;
|
|
909
|
+
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Sets this matrix as a rotational transformation around the given axis by
|
|
914
|
+
* the given angle.
|
|
915
|
+
*
|
|
916
|
+
* This is a somewhat controversial but mathematically sound alternative to
|
|
917
|
+
* rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
|
|
918
|
+
*
|
|
919
|
+
* @param {Vector3} axis - The normalized rotation axis.
|
|
920
|
+
* @param {number} angle - The rotation in radians.
|
|
921
|
+
* @return {Matrix4} A reference to this matrix.
|
|
922
|
+
*/
|
|
923
|
+
makeRotationAxis( axis, angle ) {
|
|
924
|
+
|
|
925
|
+
// Based on http://www.gamedev.net/reference/articles/article1199.asp
|
|
926
|
+
|
|
927
|
+
const c = Math.cos( angle );
|
|
928
|
+
const s = Math.sin( angle );
|
|
929
|
+
const t = 1 - c;
|
|
930
|
+
const x = axis.x, y = axis.y, z = axis.z;
|
|
931
|
+
const tx = t * x, ty = t * y;
|
|
932
|
+
|
|
933
|
+
this.set(
|
|
934
|
+
|
|
935
|
+
tx * x + c, tx * y - s * z, tx * z + s * y, 0,
|
|
936
|
+
tx * y + s * z, ty * y + c, ty * z - s * x, 0,
|
|
937
|
+
tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
|
|
938
|
+
0, 0, 0, 1
|
|
939
|
+
|
|
940
|
+
);
|
|
941
|
+
|
|
942
|
+
return this;
|
|
943
|
+
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Sets this matrix as a scale transformation.
|
|
948
|
+
*
|
|
949
|
+
* @param {number} x - The amount to scale in the X axis.
|
|
950
|
+
* @param {number} y - The amount to scale in the Y axis.
|
|
951
|
+
* @param {number} z - The amount to scale in the Z axis.
|
|
952
|
+
* @return {Matrix4} A reference to this matrix.
|
|
953
|
+
*/
|
|
954
|
+
makeScale( x, y, z ) {
|
|
955
|
+
|
|
956
|
+
this.set(
|
|
957
|
+
|
|
958
|
+
x, 0, 0, 0,
|
|
959
|
+
0, y, 0, 0,
|
|
960
|
+
0, 0, z, 0,
|
|
961
|
+
0, 0, 0, 1
|
|
962
|
+
|
|
963
|
+
);
|
|
964
|
+
|
|
965
|
+
return this;
|
|
966
|
+
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Sets this matrix as a shear transformation.
|
|
971
|
+
*
|
|
972
|
+
* @param {number} xy - The amount to shear X by Y.
|
|
973
|
+
* @param {number} xz - The amount to shear X by Z.
|
|
974
|
+
* @param {number} yx - The amount to shear Y by X.
|
|
975
|
+
* @param {number} yz - The amount to shear Y by Z.
|
|
976
|
+
* @param {number} zx - The amount to shear Z by X.
|
|
977
|
+
* @param {number} zy - The amount to shear Z by Y.
|
|
978
|
+
* @return {Matrix4} A reference to this matrix.
|
|
979
|
+
*/
|
|
980
|
+
makeShear( xy, xz, yx, yz, zx, zy ) {
|
|
981
|
+
|
|
982
|
+
this.set(
|
|
983
|
+
|
|
984
|
+
1, yx, zx, 0,
|
|
985
|
+
xy, 1, zy, 0,
|
|
986
|
+
xz, yz, 1, 0,
|
|
987
|
+
0, 0, 0, 1
|
|
988
|
+
|
|
989
|
+
);
|
|
990
|
+
|
|
991
|
+
return this;
|
|
992
|
+
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Sets this matrix to the transformation composed of the given position,
|
|
997
|
+
* rotation (Quaternion) and scale.
|
|
998
|
+
*
|
|
999
|
+
* @param {Vector3} position - The position vector.
|
|
1000
|
+
* @param {Quaternion} quaternion - The rotation as a Quaternion.
|
|
1001
|
+
* @param {Vector3} scale - The scale vector.
|
|
1002
|
+
* @return {Matrix4} A reference to this matrix.
|
|
1003
|
+
*/
|
|
1004
|
+
compose( position, quaternion, scale ) {
|
|
1005
|
+
|
|
1006
|
+
const te = this.elements;
|
|
1007
|
+
|
|
1008
|
+
const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
|
|
1009
|
+
const x2 = x + x, y2 = y + y, z2 = z + z;
|
|
1010
|
+
const xx = x * x2, xy = x * y2, xz = x * z2;
|
|
1011
|
+
const yy = y * y2, yz = y * z2, zz = z * z2;
|
|
1012
|
+
const wx = w * x2, wy = w * y2, wz = w * z2;
|
|
1013
|
+
|
|
1014
|
+
const sx = scale.x, sy = scale.y, sz = scale.z;
|
|
1015
|
+
|
|
1016
|
+
te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
|
|
1017
|
+
te[ 1 ] = ( xy + wz ) * sx;
|
|
1018
|
+
te[ 2 ] = ( xz - wy ) * sx;
|
|
1019
|
+
te[ 3 ] = 0;
|
|
1020
|
+
|
|
1021
|
+
te[ 4 ] = ( xy - wz ) * sy;
|
|
1022
|
+
te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
|
|
1023
|
+
te[ 6 ] = ( yz + wx ) * sy;
|
|
1024
|
+
te[ 7 ] = 0;
|
|
1025
|
+
|
|
1026
|
+
te[ 8 ] = ( xz + wy ) * sz;
|
|
1027
|
+
te[ 9 ] = ( yz - wx ) * sz;
|
|
1028
|
+
te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
|
|
1029
|
+
te[ 11 ] = 0;
|
|
1030
|
+
|
|
1031
|
+
te[ 12 ] = position.x;
|
|
1032
|
+
te[ 13 ] = position.y;
|
|
1033
|
+
te[ 14 ] = position.z;
|
|
1034
|
+
te[ 15 ] = 1;
|
|
1035
|
+
|
|
1036
|
+
return this;
|
|
1037
|
+
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Decomposes this matrix into its position, rotation and scale components
|
|
1042
|
+
* and provides the result in the given objects.
|
|
1043
|
+
*
|
|
1044
|
+
* Note: Not all matrices are decomposable in this way. For example, if an
|
|
1045
|
+
* object has a non-uniformly scaled parent, then the object's world matrix
|
|
1046
|
+
* may not be decomposable, and this method may not be appropriate.
|
|
1047
|
+
*
|
|
1048
|
+
* @param {Vector3} position - The position vector.
|
|
1049
|
+
* @param {Quaternion} quaternion - The rotation as a Quaternion.
|
|
1050
|
+
* @param {Vector3} scale - The scale vector.
|
|
1051
|
+
* @return {Matrix4} A reference to this matrix.
|
|
1052
|
+
*/
|
|
1053
|
+
decompose( position, quaternion, scale ) {
|
|
1054
|
+
|
|
1055
|
+
const te = this.elements;
|
|
1056
|
+
|
|
1057
|
+
position.x = te[ 12 ];
|
|
1058
|
+
position.y = te[ 13 ];
|
|
1059
|
+
position.z = te[ 14 ];
|
|
1060
|
+
|
|
1061
|
+
const det = this.determinant();
|
|
1062
|
+
|
|
1063
|
+
if ( det === 0 ) {
|
|
1064
|
+
|
|
1065
|
+
scale.set( 1, 1, 1 );
|
|
1066
|
+
quaternion.identity();
|
|
1067
|
+
|
|
1068
|
+
return this;
|
|
1069
|
+
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
let sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();
|
|
1073
|
+
const sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();
|
|
1074
|
+
const sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();
|
|
1075
|
+
|
|
1076
|
+
// if determinant is negative, we need to invert one scale
|
|
1077
|
+
if ( det < 0 ) sx = - sx;
|
|
1078
|
+
|
|
1079
|
+
// scale the rotation part
|
|
1080
|
+
_m1.copy( this );
|
|
1081
|
+
|
|
1082
|
+
const invSX = 1 / sx;
|
|
1083
|
+
const invSY = 1 / sy;
|
|
1084
|
+
const invSZ = 1 / sz;
|
|
1085
|
+
|
|
1086
|
+
_m1.elements[ 0 ] *= invSX;
|
|
1087
|
+
_m1.elements[ 1 ] *= invSX;
|
|
1088
|
+
_m1.elements[ 2 ] *= invSX;
|
|
1089
|
+
|
|
1090
|
+
_m1.elements[ 4 ] *= invSY;
|
|
1091
|
+
_m1.elements[ 5 ] *= invSY;
|
|
1092
|
+
_m1.elements[ 6 ] *= invSY;
|
|
1093
|
+
|
|
1094
|
+
_m1.elements[ 8 ] *= invSZ;
|
|
1095
|
+
_m1.elements[ 9 ] *= invSZ;
|
|
1096
|
+
_m1.elements[ 10 ] *= invSZ;
|
|
1097
|
+
|
|
1098
|
+
quaternion.setFromRotationMatrix( _m1 );
|
|
1099
|
+
|
|
1100
|
+
scale.x = sx;
|
|
1101
|
+
scale.y = sy;
|
|
1102
|
+
scale.z = sz;
|
|
1103
|
+
|
|
1104
|
+
return this;
|
|
1105
|
+
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Creates a perspective projection matrix. This is used internally by
|
|
1110
|
+
* {@link PerspectiveCamera#updateProjectionMatrix}.
|
|
1111
|
+
|
|
1112
|
+
* @param {number} left - Left boundary of the viewing frustum at the near plane.
|
|
1113
|
+
* @param {number} right - Right boundary of the viewing frustum at the near plane.
|
|
1114
|
+
* @param {number} top - Top boundary of the viewing frustum at the near plane.
|
|
1115
|
+
* @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.
|
|
1116
|
+
* @param {number} near - The distance from the camera to the near plane.
|
|
1117
|
+
* @param {number} far - The distance from the camera to the far plane.
|
|
1118
|
+
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
1119
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
1120
|
+
* @return {Matrix4} A reference to this matrix.
|
|
1121
|
+
*/
|
|
1122
|
+
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
1123
|
+
|
|
1124
|
+
const te = this.elements;
|
|
1125
|
+
|
|
1126
|
+
const x = 2 * near / ( right - left );
|
|
1127
|
+
const y = 2 * near / ( top - bottom );
|
|
1128
|
+
|
|
1129
|
+
const a = ( right + left ) / ( right - left );
|
|
1130
|
+
const b = ( top + bottom ) / ( top - bottom );
|
|
1131
|
+
|
|
1132
|
+
let c, d;
|
|
1133
|
+
|
|
1134
|
+
if ( reversedDepth ) {
|
|
1135
|
+
|
|
1136
|
+
c = near / ( far - near );
|
|
1137
|
+
d = ( far * near ) / ( far - near );
|
|
1138
|
+
|
|
1139
|
+
} else {
|
|
1140
|
+
|
|
1141
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
1142
|
+
|
|
1143
|
+
c = - ( far + near ) / ( far - near );
|
|
1144
|
+
d = ( - 2 * far * near ) / ( far - near );
|
|
1145
|
+
|
|
1146
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
1147
|
+
|
|
1148
|
+
c = - far / ( far - near );
|
|
1149
|
+
d = ( - far * near ) / ( far - near );
|
|
1150
|
+
|
|
1151
|
+
} else {
|
|
1152
|
+
|
|
1153
|
+
throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
|
|
1154
|
+
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
|
|
1160
|
+
te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
|
|
1161
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
1162
|
+
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
|
|
1163
|
+
|
|
1164
|
+
return this;
|
|
1165
|
+
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Creates a orthographic projection matrix. This is used internally by
|
|
1170
|
+
* {@link OrthographicCamera#updateProjectionMatrix}.
|
|
1171
|
+
|
|
1172
|
+
* @param {number} left - Left boundary of the viewing frustum at the near plane.
|
|
1173
|
+
* @param {number} right - Right boundary of the viewing frustum at the near plane.
|
|
1174
|
+
* @param {number} top - Top boundary of the viewing frustum at the near plane.
|
|
1175
|
+
* @param {number} bottom - Bottom boundary of the viewing frustum at the near plane.
|
|
1176
|
+
* @param {number} near - The distance from the camera to the near plane.
|
|
1177
|
+
* @param {number} far - The distance from the camera to the far plane.
|
|
1178
|
+
* @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system.
|
|
1179
|
+
* @param {boolean} [reversedDepth=false] - Whether to use a reversed depth.
|
|
1180
|
+
* @return {Matrix4} A reference to this matrix.
|
|
1181
|
+
*/
|
|
1182
|
+
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem, reversedDepth = false ) {
|
|
1183
|
+
|
|
1184
|
+
const te = this.elements;
|
|
1185
|
+
|
|
1186
|
+
const x = 2 / ( right - left );
|
|
1187
|
+
const y = 2 / ( top - bottom );
|
|
1188
|
+
|
|
1189
|
+
const a = - ( right + left ) / ( right - left );
|
|
1190
|
+
const b = - ( top + bottom ) / ( top - bottom );
|
|
1191
|
+
|
|
1192
|
+
let c, d;
|
|
1193
|
+
|
|
1194
|
+
if ( reversedDepth ) {
|
|
1195
|
+
|
|
1196
|
+
c = 1 / ( far - near );
|
|
1197
|
+
d = far / ( far - near );
|
|
1198
|
+
|
|
1199
|
+
} else {
|
|
1200
|
+
|
|
1201
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
1202
|
+
|
|
1203
|
+
c = - 2 / ( far - near );
|
|
1204
|
+
d = - ( far + near ) / ( far - near );
|
|
1205
|
+
|
|
1206
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
1207
|
+
|
|
1208
|
+
c = - 1 / ( far - near );
|
|
1209
|
+
d = - near / ( far - near );
|
|
1210
|
+
|
|
1211
|
+
} else {
|
|
1212
|
+
|
|
1213
|
+
throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
|
|
1214
|
+
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = a;
|
|
1220
|
+
te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = 0; te[ 13 ] = b;
|
|
1221
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
1222
|
+
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
1223
|
+
|
|
1224
|
+
return this;
|
|
1225
|
+
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Returns `true` if this matrix is equal with the given one.
|
|
1230
|
+
*
|
|
1231
|
+
* @param {Matrix4} matrix - The matrix to test for equality.
|
|
1232
|
+
* @return {boolean} Whether this matrix is equal with the given one.
|
|
1233
|
+
*/
|
|
1234
|
+
equals( matrix ) {
|
|
1235
|
+
|
|
1236
|
+
const te = this.elements;
|
|
1237
|
+
const me = matrix.elements;
|
|
1238
|
+
|
|
1239
|
+
for ( let i = 0; i < 16; i ++ ) {
|
|
1240
|
+
|
|
1241
|
+
if ( te[ i ] !== me[ i ] ) return false;
|
|
1242
|
+
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
return true;
|
|
1246
|
+
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Sets the elements of the matrix from the given array.
|
|
1251
|
+
*
|
|
1252
|
+
* @param {Array<number>} array - The matrix elements in column-major order.
|
|
1253
|
+
* @param {number} [offset=0] - Index of the first element in the array.
|
|
1254
|
+
* @return {Matrix4} A reference to this matrix.
|
|
1255
|
+
*/
|
|
1256
|
+
fromArray( array, offset = 0 ) {
|
|
1257
|
+
|
|
1258
|
+
for ( let i = 0; i < 16; i ++ ) {
|
|
1259
|
+
|
|
1260
|
+
this.elements[ i ] = array[ i + offset ];
|
|
1261
|
+
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
return this;
|
|
1265
|
+
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Writes the elements of this matrix to the given array. If no array is provided,
|
|
1270
|
+
* the method returns a new instance.
|
|
1271
|
+
*
|
|
1272
|
+
* @param {Array<number>} [array=[]] - The target array holding the matrix elements in column-major order.
|
|
1273
|
+
* @param {number} [offset=0] - Index of the first element in the array.
|
|
1274
|
+
* @return {Array<number>} The matrix elements in column-major order.
|
|
1275
|
+
*/
|
|
1276
|
+
toArray( array = [], offset = 0 ) {
|
|
1277
|
+
|
|
1278
|
+
const te = this.elements;
|
|
1279
|
+
|
|
1280
|
+
array[ offset ] = te[ 0 ];
|
|
1281
|
+
array[ offset + 1 ] = te[ 1 ];
|
|
1282
|
+
array[ offset + 2 ] = te[ 2 ];
|
|
1283
|
+
array[ offset + 3 ] = te[ 3 ];
|
|
1284
|
+
|
|
1285
|
+
array[ offset + 4 ] = te[ 4 ];
|
|
1286
|
+
array[ offset + 5 ] = te[ 5 ];
|
|
1287
|
+
array[ offset + 6 ] = te[ 6 ];
|
|
1288
|
+
array[ offset + 7 ] = te[ 7 ];
|
|
1289
|
+
|
|
1290
|
+
array[ offset + 8 ] = te[ 8 ];
|
|
1291
|
+
array[ offset + 9 ] = te[ 9 ];
|
|
1292
|
+
array[ offset + 10 ] = te[ 10 ];
|
|
1293
|
+
array[ offset + 11 ] = te[ 11 ];
|
|
1294
|
+
|
|
1295
|
+
array[ offset + 12 ] = te[ 12 ];
|
|
1296
|
+
array[ offset + 13 ] = te[ 13 ];
|
|
1297
|
+
array[ offset + 14 ] = te[ 14 ];
|
|
1298
|
+
array[ offset + 15 ] = te[ 15 ];
|
|
1299
|
+
|
|
1300
|
+
return array;
|
|
1301
|
+
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
const _v1 = /*@__PURE__*/ new Vector3();
|
|
1307
|
+
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
1308
|
+
const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
|
|
1309
|
+
const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
|
|
1310
|
+
const _x = /*@__PURE__*/ new Vector3();
|
|
1311
|
+
const _y = /*@__PURE__*/ new Vector3();
|
|
1312
|
+
const _z = /*@__PURE__*/ new Vector3();
|
|
1313
|
+
|
|
1314
|
+
export { Matrix4 };
|