@unikia/upe-renderer 0.0.0-stage → 0.187.11
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/LICENSE.types +21 -0
- package/README.md +35 -2
- package/README.three.md +85 -0
- package/UPSTREAM.md +11 -0
- package/build/three.cjs +17 -0
- package/build/three.core.d.ts +1 -0
- package/build/three.core.js +61178 -0
- package/build/three.d.cts +1 -0
- package/build/three.module.d.ts +1 -0
- package/build/three.module.js +19537 -0
- package/build/three.tsl.d.ts +1 -0
- package/build/three.tsl.js +41943 -0
- package/build/three.webgpu.d.ts +1 -0
- package/build/three.webgpu.js +54819 -0
- package/build/three.webgpu.nodes.d.ts +1 -0
- package/build/three.webgpu.nodes.js +96449 -0
- package/examples/jsm/Addons.d.ts +300 -0
- package/examples/jsm/Addons.js +303 -0
- package/examples/jsm/animation/AnimationClipCreator.d.ts +12 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.d.ts +44 -0
- package/examples/jsm/animation/CCDIKSolver.js +607 -0
- package/examples/jsm/capabilities/WebGL.d.ts +6 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.d.ts +7 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.d.ts +208 -0
- package/examples/jsm/controls/ArcballControls.js +3543 -0
- package/examples/jsm/controls/DragControls.d.ts +81 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.d.ts +105 -0
- package/examples/jsm/controls/FirstPersonControls.js +512 -0
- package/examples/jsm/controls/FlyControls.d.ts +44 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.d.ts +21 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.d.ts +295 -0
- package/examples/jsm/controls/OrbitControls.js +1985 -0
- package/examples/jsm/controls/PointerLockControls.d.ts +84 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.d.ts +152 -0
- package/examples/jsm/controls/TrackballControls.js +1106 -0
- package/examples/jsm/controls/TransformControls.d.ts +363 -0
- package/examples/jsm/controls/TransformControls.js +2003 -0
- package/examples/jsm/csm/CSM.d.ts +55 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.d.ts +85 -0
- package/examples/jsm/csm/CSMFrustum.js +234 -0
- package/examples/jsm/csm/CSMHelper.d.ts +28 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.d.ts +4 -0
- package/examples/jsm/csm/CSMShader.js +378 -0
- package/examples/jsm/csm/CSMShadowNode.d.ts +44 -0
- package/examples/jsm/csm/CSMShadowNode.js +619 -0
- package/examples/jsm/curves/CurveExtras.d.ts +68 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.d.ts +28 -0
- package/examples/jsm/curves/NURBSCurve.js +169 -0
- package/examples/jsm/curves/NURBSSurface.d.ts +13 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.d.ts +146 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.d.ts +23 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.d.ts +21 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.d.ts +18 -0
- package/examples/jsm/effects/AsciiEffect.js +323 -0
- package/examples/jsm/effects/OutlineEffect.d.ts +28 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.d.ts +11 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.d.ts +9 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.d.ts +5 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.d.ts +6 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.d.ts +17 -0
- package/examples/jsm/exporters/DRACOExporter.js +332 -0
- package/examples/jsm/exporters/EXRExporter.d.ts +27 -0
- package/examples/jsm/exporters/EXRExporter.js +1275 -0
- package/examples/jsm/exporters/GLTFExporter.d.ts +161 -0
- package/examples/jsm/exporters/GLTFExporter.js +3856 -0
- package/examples/jsm/exporters/KTX2Exporter.d.ts +7 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.d.ts +7 -0
- package/examples/jsm/exporters/OBJExporter.js +351 -0
- package/examples/jsm/exporters/PLYExporter.d.ts +31 -0
- package/examples/jsm/exporters/PLYExporter.js +786 -0
- package/examples/jsm/exporters/STLExporter.d.ts +21 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.d.ts +30 -0
- package/examples/jsm/exporters/USDZExporter.js +1489 -0
- package/examples/jsm/generators/CityGenerator.d.ts +131 -0
- package/examples/jsm/generators/CityGenerator.js +679 -0
- package/examples/jsm/generators/ForestGenerator.d.ts +73 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.d.ts +57 -0
- package/examples/jsm/generators/TerrainGenerator.js +516 -0
- package/examples/jsm/generators/TreeGenerator.d.ts +102 -0
- package/examples/jsm/generators/TreeGenerator.js +371 -0
- package/examples/jsm/generators/city/BenchGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/BenchGenerator.js +127 -0
- package/examples/jsm/generators/city/CarGenerator.d.ts +43 -0
- package/examples/jsm/generators/city/CarGenerator.js +479 -0
- package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
- package/examples/jsm/generators/city/HydrantGenerator.d.ts +27 -0
- package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
- package/examples/jsm/generators/city/InstancedMeshGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
- package/examples/jsm/generators/city/PersonGenerator.d.ts +44 -0
- package/examples/jsm/generators/city/PersonGenerator.js +447 -0
- package/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +248 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1799 -0
- package/examples/jsm/generators/city/StreetTreeGenerator.d.ts +30 -0
- package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
- package/examples/jsm/generators/city/StreetlightGenerator.d.ts +28 -0
- package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
- package/examples/jsm/generators/city/TrafficlightGenerator.d.ts +29 -0
- package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
- package/examples/jsm/generators/city/TrashcanGenerator.d.ts +24 -0
- package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
- package/examples/jsm/geometries/BoxLineGeometry.d.ts +12 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.d.ts +5 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.d.ts +16 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.d.ts +18 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.d.ts +5 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.d.ts +37 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.d.ts +89 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.d.ts +21 -0
- package/examples/jsm/gpgpu/BitonicSort.js +722 -0
- package/examples/jsm/gpgpu/CountingSort.d.ts +31 -0
- package/examples/jsm/gpgpu/CountingSort.js +271 -0
- package/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +166 -0
- package/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeHelper.js +166 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.d.ts +17 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.d.ts +13 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.d.ts +13 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.d.ts +10 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.d.ts +10 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.d.ts +14 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.d.ts +12 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.d.ts +20 -0
- package/examples/jsm/helpers/ViewHelper.js +529 -0
- package/examples/jsm/inspector/Extension.d.ts +22 -0
- package/examples/jsm/inspector/Extension.js +107 -0
- package/examples/jsm/inspector/Inspector.d.ts +54 -0
- package/examples/jsm/inspector/Inspector.js +644 -0
- package/examples/jsm/inspector/RendererInspector.d.ts +9 -0
- package/examples/jsm/inspector/RendererInspector.js +624 -0
- package/examples/jsm/inspector/Storage.js +49 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts +34 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2614 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
- package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
- package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
- package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
- package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +20 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +911 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +11 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +282 -0
- package/examples/jsm/inspector/tabs/Console.js +420 -0
- package/examples/jsm/inspector/tabs/Memory.js +134 -0
- package/examples/jsm/inspector/tabs/Parameters.d.ts +122 -0
- package/examples/jsm/inspector/tabs/Parameters.js +444 -0
- package/examples/jsm/inspector/tabs/Performance.js +298 -0
- package/examples/jsm/inspector/tabs/Settings.js +310 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1824 -0
- package/examples/jsm/inspector/tabs/Viewer.js +1389 -0
- package/examples/jsm/inspector/ui/Graph.js +232 -0
- package/examples/jsm/inspector/ui/Item.d.ts +5 -0
- package/examples/jsm/inspector/ui/Item.js +249 -0
- package/examples/jsm/inspector/ui/List.js +81 -0
- package/examples/jsm/inspector/ui/Profiler.js +2273 -0
- package/examples/jsm/inspector/ui/Style.js +2268 -0
- package/examples/jsm/inspector/ui/Tab.d.ts +9 -0
- package/examples/jsm/inspector/ui/Tab.js +269 -0
- package/examples/jsm/inspector/ui/Values.d.ts +103 -0
- package/examples/jsm/inspector/ui/Values.js +578 -0
- package/examples/jsm/inspector/ui/utils.js +189 -0
- package/examples/jsm/interaction/InteractionManager.d.ts +18 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.d.ts +13 -0
- package/examples/jsm/interactive/HTMLMesh.js +617 -0
- package/examples/jsm/interactive/InteractiveGroup.d.ts +28 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.d.ts +16 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.d.ts +17 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/basis/README.md +45 -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 +31 -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_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_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/fflate.module.d.ts +1 -0
- package/examples/jsm/libs/fflate.module.js +2699 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.d.ts +608 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.README.md +27 -0
- package/examples/jsm/libs/mikktspace.module.d.ts +19 -0
- package/examples/jsm/libs/mikktspace.module.js +765 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/stats.module.d.ts +3 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/tween.module.d.ts +2 -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.d.ts +5 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
- package/examples/jsm/lighting/ClusteredLighting.js +153 -0
- package/examples/jsm/lighting/DynamicLighting.d.ts +16 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightMapper.js +295 -0
- package/examples/jsm/lighting/LightProbeGrid.d.ts +177 -0
- package/examples/jsm/lighting/LightProbeGrid.js +923 -0
- package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
- package/examples/jsm/lighting/LightProbeGridWebGL.d.ts +178 -0
- package/examples/jsm/lighting/LightProbeGridWebGL.js +846 -0
- package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +243 -0
- package/examples/jsm/lighting/vxgi/VXGIIrradiance.js +43 -0
- package/examples/jsm/lighting/vxgi/VXGINode.d.ts +100 -0
- package/examples/jsm/lighting/vxgi/VXGINode.js +617 -0
- package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +793 -0
- package/examples/jsm/lighting/vxgi/VXGIVolume.d.ts +245 -0
- package/examples/jsm/lighting/vxgi/VXGIVolume.js +1440 -0
- package/examples/jsm/lights/LightProbeGenerator.d.ts +16 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.d.ts +7 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +5 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lights/SunLight.d.ts +53 -0
- package/examples/jsm/lights/SunLight.js +100 -0
- package/examples/jsm/lights/SunLightNode.d.ts +25 -0
- package/examples/jsm/lights/SunLightNode.js +56 -0
- package/examples/jsm/lights/SunLightShadow.d.ts +57 -0
- package/examples/jsm/lights/SunLightShadow.js +319 -0
- package/examples/jsm/lights/SunShadowNode.d.ts +53 -0
- package/examples/jsm/lights/SunShadowNode.js +312 -0
- package/examples/jsm/lines/Line2.d.ts +25 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.d.ts +27 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.d.ts +82 -0
- package/examples/jsm/lines/LineMaterial.js +742 -0
- package/examples/jsm/lines/LineSegments2.d.ts +39 -0
- package/examples/jsm/lines/LineSegments2.js +434 -0
- package/examples/jsm/lines/LineSegmentsGeometry.d.ts +53 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.d.ts +14 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.d.ts +8 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.d.ts +14 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.d.ts +15 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +419 -0
- package/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.d.ts +12 -0
- package/examples/jsm/loaders/3DMLoader.js +1946 -0
- package/examples/jsm/loaders/3MFLoader.d.ts +9 -0
- package/examples/jsm/loaders/3MFLoader.js +1826 -0
- package/examples/jsm/loaders/AMFLoader.d.ts +7 -0
- package/examples/jsm/loaders/AMFLoader.js +543 -0
- package/examples/jsm/loaders/BVHLoader.d.ts +14 -0
- package/examples/jsm/loaders/BVHLoader.js +486 -0
- package/examples/jsm/loaders/ColladaLoader.d.ts +35 -0
- package/examples/jsm/loaders/ColladaLoader.js +161 -0
- package/examples/jsm/loaders/DDSLoader.d.ts +22 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.d.ts +39 -0
- package/examples/jsm/loaders/DRACOLoader.js +776 -0
- package/examples/jsm/loaders/EXRLoader.d.ts +24 -0
- package/examples/jsm/loaders/EXRLoader.js +3411 -0
- package/examples/jsm/loaders/FBXLoader.d.ts +8 -0
- package/examples/jsm/loaders/FBXLoader.js +4660 -0
- package/examples/jsm/loaders/FontLoader.d.ts +41 -0
- package/examples/jsm/loaders/FontLoader.js +262 -0
- package/examples/jsm/loaders/GCodeLoader.d.ts +8 -0
- package/examples/jsm/loaders/GCodeLoader.js +314 -0
- package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts +14 -0
- package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
- package/examples/jsm/loaders/GLTFLoader.d.ts +153 -0
- package/examples/jsm/loaders/GLTFLoader.js +5006 -0
- package/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts +9 -0
- package/examples/jsm/loaders/GaussianSplatPLYLoader.js +388 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +18 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +167 -0
- package/examples/jsm/loaders/HDRLoader.d.ts +12 -0
- package/examples/jsm/loaders/HDRLoader.js +463 -0
- package/examples/jsm/loaders/IESLoader.d.ts +5 -0
- package/examples/jsm/loaders/IESLoader.js +413 -0
- package/examples/jsm/loaders/JXLLoader.js +159 -0
- package/examples/jsm/loaders/KMZLoader.d.ts +9 -0
- package/examples/jsm/loaders/KMZLoader.js +169 -0
- package/examples/jsm/loaders/KSPLATLoader.d.ts +9 -0
- package/examples/jsm/loaders/KSPLATLoader.js +465 -0
- package/examples/jsm/loaders/KTX2Loader.d.ts +58 -0
- package/examples/jsm/loaders/KTX2Loader.js +1321 -0
- package/examples/jsm/loaders/KTXLoader.d.ts +22 -0
- package/examples/jsm/loaders/KTXLoader.js +199 -0
- package/examples/jsm/loaders/LDrawLoader.d.ts +38 -0
- package/examples/jsm/loaders/LDrawLoader.js +2503 -0
- package/examples/jsm/loaders/LUT3dlLoader.d.ts +39 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +209 -0
- package/examples/jsm/loaders/LUTCubeLoader.d.ts +42 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +194 -0
- package/examples/jsm/loaders/LUTImageLoader.d.ts +18 -0
- package/examples/jsm/loaders/LUTImageLoader.js +192 -0
- package/examples/jsm/loaders/LWOLoader.d.ts +25 -0
- package/examples/jsm/loaders/LWOLoader.js +1057 -0
- package/examples/jsm/loaders/MD2Loader.d.ts +7 -0
- package/examples/jsm/loaders/MD2Loader.js +437 -0
- package/examples/jsm/loaders/MDDLoader.d.ts +12 -0
- package/examples/jsm/loaders/MDDLoader.js +151 -0
- package/examples/jsm/loaders/MTLLoader.d.ts +95 -0
- package/examples/jsm/loaders/MTLLoader.js +601 -0
- package/examples/jsm/loaders/MaterialXLoader.d.ts +70 -0
- package/examples/jsm/loaders/MaterialXLoader.js +279 -0
- package/examples/jsm/loaders/NRRDLoader.d.ts +15 -0
- package/examples/jsm/loaders/NRRDLoader.js +720 -0
- package/examples/jsm/loaders/OBJLoader.d.ts +10 -0
- package/examples/jsm/loaders/OBJLoader.js +961 -0
- package/examples/jsm/loaders/PCDLoader.d.ts +8 -0
- package/examples/jsm/loaders/PCDLoader.js +624 -0
- package/examples/jsm/loaders/PDBLoader.d.ts +15 -0
- package/examples/jsm/loaders/PDBLoader.js +274 -0
- package/examples/jsm/loaders/PLYLoader.d.ts +11 -0
- package/examples/jsm/loaders/PLYLoader.js +992 -0
- package/examples/jsm/loaders/PVRLoader.d.ts +16 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.d.ts +7 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/SPLATLoader.d.ts +9 -0
- package/examples/jsm/loaders/SPLATLoader.js +141 -0
- package/examples/jsm/loaders/SPZLoader.d.ts +18 -0
- package/examples/jsm/loaders/SPZLoader.js +563 -0
- package/examples/jsm/loaders/STLLoader.d.ts +7 -0
- package/examples/jsm/loaders/STLLoader.js +423 -0
- package/examples/jsm/loaders/SVGLoader.d.ts +67 -0
- package/examples/jsm/loaders/SVGLoader.js +3297 -0
- package/examples/jsm/loaders/TDSLoader.d.ts +35 -0
- package/examples/jsm/loaders/TDSLoader.js +1146 -0
- package/examples/jsm/loaders/TGALoader.d.ts +7 -0
- package/examples/jsm/loaders/TGALoader.js +539 -0
- package/examples/jsm/loaders/TIFFLoader.d.ts +7 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.d.ts +10 -0
- package/examples/jsm/loaders/TTFLoader.js +263 -0
- package/examples/jsm/loaders/USDLoader.d.ts +14 -0
- package/examples/jsm/loaders/USDLoader.js +317 -0
- package/examples/jsm/loaders/USDZLoader.d.ts +14 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.d.ts +28 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +757 -0
- package/examples/jsm/loaders/VOXLoader.d.ts +38 -0
- package/examples/jsm/loaders/VOXLoader.js +922 -0
- package/examples/jsm/loaders/VRMLLoader.d.ts +7 -0
- package/examples/jsm/loaders/VRMLLoader.js +3650 -0
- package/examples/jsm/loaders/VTKLoader.d.ts +13 -0
- package/examples/jsm/loaders/VTKLoader.js +1295 -0
- package/examples/jsm/loaders/XYZLoader.d.ts +7 -0
- package/examples/jsm/loaders/XYZLoader.js +145 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3051 -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/materialx/MaterialXArchive.js +108 -0
- package/examples/jsm/loaders/materialx/MaterialXDocument.js +1350 -0
- package/examples/jsm/loaders/materialx/MaterialXHextile.d.ts +24 -0
- package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts +8 -0
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +293 -0
- package/examples/jsm/loaders/materialx/MaterialXLog.d.ts +33 -0
- package/examples/jsm/loaders/materialx/MaterialXLog.js +79 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeDefs.js +99 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +763 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +871 -0
- package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +565 -0
- package/examples/jsm/loaders/materialx/MaterialXUtils.js +82 -0
- package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +999 -0
- package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
- package/examples/jsm/loaders/usd/USDAParser.js +923 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1875 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4660 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.d.ts +75 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +431 -0
- package/examples/jsm/math/Capsule.d.ts +26 -0
- package/examples/jsm/math/Capsule.js +159 -0
- package/examples/jsm/math/ColorConverter.d.ts +19 -0
- package/examples/jsm/math/ColorConverter.js +62 -0
- package/examples/jsm/math/ColorSpaces.d.ts +15 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.d.ts +89 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.d.ts +4 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.d.ts +27 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.d.ts +21 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.d.ts +24 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.d.ts +54 -0
- package/examples/jsm/math/Octree.js +825 -0
- package/examples/jsm/math/SimplexNoise.d.ts +9 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.d.ts +25 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.d.ts +55 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.d.ts +5 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.d.ts +33 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.d.ts +55 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.d.ts +13 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.d.ts +21 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.d.ts +58 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.d.ts +26 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
- package/examples/jsm/misc/Sculptor.d.ts +259 -0
- package/examples/jsm/misc/Sculptor.js +1679 -0
- package/examples/jsm/misc/SculptorMesh.js +1504 -0
- package/examples/jsm/misc/SculptorTools.js +1180 -0
- package/examples/jsm/misc/SculptorUtils.js +345 -0
- package/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/TubePainter.d.ts +10 -0
- package/examples/jsm/misc/TubePainter.js +611 -0
- package/examples/jsm/misc/Volume.d.ts +37 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.d.ts +28 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.d.ts +41 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.d.ts +26 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.d.ts +6 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +139 -0
- package/examples/jsm/modifiers/TessellateModifier.d.ts +9 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GaussianSplat.d.ts +35 -0
- package/examples/jsm/objects/GaussianSplat.js +1040 -0
- package/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.d.ts +21 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.d.ts +21 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.d.ts +76 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.d.ts +54 -0
- package/examples/jsm/objects/Reflector.js +390 -0
- package/examples/jsm/objects/ReflectorForSSRPass.d.ts +62 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.d.ts +21 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.d.ts +10 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.d.ts +28 -0
- package/examples/jsm/objects/Sky.js +342 -0
- package/examples/jsm/objects/SkyMesh.d.ts +26 -0
- package/examples/jsm/objects/SkyMesh.js +403 -0
- package/examples/jsm/objects/Water.d.ts +22 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.d.ts +21 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.d.ts +53 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.d.ts +40 -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.d.ts +9 -0
- package/examples/jsm/physics/AmmoPhysics.js +366 -0
- package/examples/jsm/physics/JoltPhysics.d.ts +10 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.d.ts +26 -0
- package/examples/jsm/physics/RapierPhysics.js +461 -0
- package/examples/jsm/pipelines/MeshletDrawingPipeline.js +5571 -0
- package/examples/jsm/pipelines/VisibilityBufferDrawingPipeline.js +954 -0
- package/examples/jsm/postprocessing/AfterimagePass.d.ts +17 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +187 -0
- package/examples/jsm/postprocessing/BloomPass.d.ts +14 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.d.ts +23 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.d.ts +9 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.d.ts +14 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.d.ts +10 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.d.ts +30 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.d.ts +10 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.d.ts +121 -0
- package/examples/jsm/postprocessing/GTAOPass.js +735 -0
- package/examples/jsm/postprocessing/GlitchPass.d.ts +16 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.d.ts +37 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.d.ts +13 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.d.ts +14 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.d.ts +64 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.d.ts +14 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.d.ts +31 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.d.ts +28 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +30 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.d.ts +70 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.d.ts +21 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.d.ts +26 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.d.ts +68 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.d.ts +99 -0
- package/examples/jsm/postprocessing/SSRPass.js +858 -0
- package/examples/jsm/postprocessing/SavePass.d.ts +12 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.d.ts +11 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.d.ts +8 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.d.ts +12 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.d.ts +26 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
- package/examples/jsm/renderers/CSS2DRenderer.d.ts +29 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +352 -0
- package/examples/jsm/renderers/CSS3DRenderer.d.ts +26 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.d.ts +60 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.d.ts +26 -0
- package/examples/jsm/renderers/SVGRenderer.js +800 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +11 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.d.ts +12 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.d.ts +6 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.d.ts +10 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.d.ts +13 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.d.ts +21 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.d.ts +44 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.d.ts +12 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.d.ts +13 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.d.ts +10 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.d.ts +17 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.d.ts +10 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.d.ts +13 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +28 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +183 -0
- package/examples/jsm/shaders/DigitalGlitch.d.ts +19 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.d.ts +13 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.d.ts +11 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.d.ts +11 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.d.ts +12 -0
- package/examples/jsm/shaders/FilmShader.js +73 -0
- package/examples/jsm/shaders/FocusShader.d.ts +14 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.d.ts +11 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.d.ts +59 -0
- package/examples/jsm/shaders/GTAOShader.js +437 -0
- package/examples/jsm/shaders/GammaCorrectionShader.d.ts +9 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.d.ts +22 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.d.ts +10 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +12 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.d.ts +12 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.d.ts +12 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.d.ts +15 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.d.ts +10 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.d.ts +11 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.d.ts +13 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.d.ts +11 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.d.ts +28 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +230 -0
- package/examples/jsm/shaders/RGBShiftShader.d.ts +11 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.d.ts +29 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.d.ts +43 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.d.ts +49 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.d.ts +62 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.d.ts +10 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.d.ts +11 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +38 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.d.ts +10 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.d.ts +54 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.d.ts +11 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +11 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.d.ts +16 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.d.ts +10 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +12 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.d.ts +11 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.d.ts +14 -0
- package/examples/jsm/shaders/VolumeShader.js +285 -0
- package/examples/jsm/shaders/WaterRefractionShader.d.ts +14 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.d.ts +3 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.d.ts +293 -0
- package/examples/jsm/transpiler/AST.js +694 -0
- package/examples/jsm/transpiler/GLSLDecoder.d.ts +7 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1718 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.d.ts +3 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.d.ts +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +1055 -0
- package/examples/jsm/transpiler/Transpiler.d.ts +5 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +868 -0
- package/examples/jsm/tsl/WebGLNodesHandler.d.ts +17 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +607 -0
- package/examples/jsm/tsl/display/AfterImageNode.d.ts +15 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +256 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +42 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +550 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +377 -0
- package/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- package/examples/jsm/tsl/display/BloomNode.d.ts +44 -0
- package/examples/jsm/tsl/display/BloomNode.js +599 -0
- package/examples/jsm/tsl/display/CRT.d.ts +22 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +19 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +163 -0
- package/examples/jsm/tsl/display/DenoiseNode.d.ts +26 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +354 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +28 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +572 -0
- package/examples/jsm/tsl/display/DotScreenNode.d.ts +17 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FSR1Node.d.ts +17 -0
- package/examples/jsm/tsl/display/FSR1Node.js +481 -0
- package/examples/jsm/tsl/display/FXAANode.d.ts +11 -0
- package/examples/jsm/tsl/display/FXAANode.js +357 -0
- package/examples/jsm/tsl/display/FilmNode.d.ts +17 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.d.ts +37 -0
- package/examples/jsm/tsl/display/GTAONode.js +727 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.d.ts +56 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +412 -0
- package/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
- package/examples/jsm/tsl/display/GodraysNode.js +604 -0
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +564 -0
- package/examples/jsm/tsl/display/LensflareNode.d.ts +34 -0
- package/examples/jsm/tsl/display/LensflareNode.js +282 -0
- package/examples/jsm/tsl/display/Lut3DNode.d.ts +19 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.d.ts +7 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OITPassNode.d.ts +64 -0
- package/examples/jsm/tsl/display/OITPassNode.js +341 -0
- package/examples/jsm/tsl/display/OutlineNode.d.ts +31 -0
- package/examples/jsm/tsl/display/OutlineNode.js +916 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +12 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +90 -0
- package/examples/jsm/tsl/display/PixelationPassNode.d.ts +27 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +227 -0
- package/examples/jsm/tsl/display/RGBShiftNode.d.ts +15 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +812 -0
- package/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
- package/examples/jsm/tsl/display/SMAANode.js +729 -0
- package/examples/jsm/tsl/display/SSAAPassNode.d.ts +18 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +344 -0
- package/examples/jsm/tsl/display/SSAONode.d.ts +116 -0
- package/examples/jsm/tsl/display/SSAONode.js +422 -0
- package/examples/jsm/tsl/display/SSGINode.d.ts +33 -0
- package/examples/jsm/tsl/display/SSGINode.js +698 -0
- package/examples/jsm/tsl/display/SSRNode.d.ts +315 -0
- package/examples/jsm/tsl/display/SSRNode.js +1430 -0
- package/examples/jsm/tsl/display/SSSNode.d.ts +20 -0
- package/examples/jsm/tsl/display/SSSNode.js +479 -0
- package/examples/jsm/tsl/display/Sepia.d.ts +3 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.d.ts +3 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.d.ts +22 -0
- package/examples/jsm/tsl/display/SharpenNode.js +284 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.d.ts +11 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +13 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +190 -0
- package/examples/jsm/tsl/display/StereoPassNode.d.ts +13 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +117 -0
- package/examples/jsm/tsl/display/TAAUNode.d.ts +31 -0
- package/examples/jsm/tsl/display/TAAUNode.js +700 -0
- package/examples/jsm/tsl/display/TRAANode.d.ts +26 -0
- package/examples/jsm/tsl/display/TRAANode.js +609 -0
- package/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1024 -0
- package/examples/jsm/tsl/display/TransitionNode.d.ts +31 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.d.ts +10 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/depthAwareBlur.d.ts +10 -0
- package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
- package/examples/jsm/tsl/display/hashBlur.d.ts +12 -0
- package/examples/jsm/tsl/display/hashBlur.js +55 -0
- package/examples/jsm/tsl/display/lensDirt.js +30 -0
- package/examples/jsm/tsl/display/radialBlur.d.ts +12 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +994 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +21 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +201 -0
- package/examples/jsm/tsl/lighting/LightProbeGridNode.js +183 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +67 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +117 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +105 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +140 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +9 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +167 -0
- package/examples/jsm/tsl/math/Bayer.d.ts +5 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -0
- package/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/math/voronoiNoise.d.ts +52 -0
- package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +542 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/Raymarching.d.ts +8 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/tsl/utils/SoftParticles.d.ts +21 -0
- package/examples/jsm/tsl/utils/SoftParticles.js +53 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +302 -0
- package/examples/jsm/tsl/utils/TAAUtils.js +184 -0
- package/examples/jsm/utils/BufferGeometryUtils.d.ts +37 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1523 -0
- package/examples/jsm/utils/CameraUtils.d.ts +9 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.d.ts +5 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GaussianSplatUtils.d.ts +68 -0
- package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
- package/examples/jsm/utils/GeometryCompressionUtils.d.ts +21 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.d.ts +25 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.d.ts +5 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/MeshletGeometryUtils.js +417 -0
- package/examples/jsm/utils/SceneOptimizer.d.ts +18 -0
- package/examples/jsm/utils/SceneOptimizer.js +459 -0
- package/examples/jsm/utils/SceneUtils.d.ts +57 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.d.ts +26 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.d.ts +32 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.d.ts +7 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.d.ts +3 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.d.ts +3 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.d.ts +3 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.d.ts +26 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/utils/unwrapUVs.js +865 -0
- package/examples/jsm/webxr/ARButton.d.ts +9 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.d.ts +23 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.d.ts +67 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.d.ts +3 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.d.ts +7 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
- package/examples/jsm/webxr/WebGLXRFallback.js +75 -0
- package/examples/jsm/webxr/XRButton.d.ts +7 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.d.ts +23 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +415 -0
- package/examples/jsm/webxr/XREstimatedLight.d.ts +69 -0
- package/examples/jsm/webxr/XREstimatedLight.js +261 -0
- package/examples/jsm/webxr/XRHandMeshModel.d.ts +20 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.d.ts +32 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +24 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.d.ts +5 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/index.d.ts +6 -0
- package/package.json +68 -4
- package/src/Three.Core.d.ts +176 -0
- package/src/Three.Core.js +189 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.d.ts +686 -0
- package/src/Three.TSL.js +3 -0
- package/src/Three.WebGPU.Nodes.d.ts +36 -0
- package/src/Three.WebGPU.Nodes.js +34 -0
- package/src/Three.WebGPU.d.ts +44 -0
- package/src/Three.WebGPU.js +44 -0
- package/src/Three.d.ts +47 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.d.ts +286 -0
- package/src/animation/AnimationAction.js +946 -0
- package/src/animation/AnimationClip.d.ts +168 -0
- package/src/animation/AnimationClip.js +502 -0
- package/src/animation/AnimationMixer.d.ts +175 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.d.ts +58 -0
- package/src/animation/AnimationObjectGroup.js +423 -0
- package/src/animation/AnimationUtils.d.ts +182 -0
- package/src/animation/AnimationUtils.js +519 -0
- package/src/animation/KeyframeTrack.d.ts +197 -0
- package/src/animation/KeyframeTrack.js +692 -0
- package/src/animation/PropertyBinding.d.ts +101 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.d.ts +75 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.d.ts +18 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.d.ts +18 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.d.ts +17 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.d.ts +340 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.d.ts +63 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.d.ts +19 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.d.ts +75 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.d.ts +108 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.d.ts +35 -0
- package/src/cameras/ArrayCamera.js +66 -0
- package/src/cameras/Camera.d.ts +42 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.d.ts +89 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.d.ts +144 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.d.ts +241 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.d.ts +44 -0
- package/src/cameras/StereoCamera.js +149 -0
- package/src/constants.d.ts +976 -0
- package/src/constants.js +1774 -0
- package/src/core/BufferAttribute.d.ts +650 -0
- package/src/core/BufferAttribute.js +1093 -0
- package/src/core/BufferGeometry.d.ts +442 -0
- package/src/core/BufferGeometry.js +1472 -0
- package/src/core/Clock.d.ts +73 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.d.ts +82 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.d.ts +138 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.d.ts +32 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.d.ts +37 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.d.ts +22 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.d.ts +162 -0
- package/src/core/InterleavedBuffer.js +305 -0
- package/src/core/InterleavedBufferAttribute.d.ts +201 -0
- package/src/core/InterleavedBufferAttribute.js +583 -0
- package/src/core/Layers.d.ts +72 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.d.ts +725 -0
- package/src/core/Object3D.js +1719 -0
- package/src/core/Raycaster.d.ts +212 -0
- package/src/core/Raycaster.js +268 -0
- package/src/core/RenderTarget.d.ts +153 -0
- package/src/core/RenderTarget.js +501 -0
- package/src/core/RenderTarget3D.d.ts +9 -0
- package/src/core/RenderTarget3D.js +52 -0
- package/src/core/Timer.d.ts +77 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.d.ts +38 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.d.ts +39 -0
- package/src/core/UniformsGroup.js +184 -0
- package/src/extras/Controls.d.ts +59 -0
- package/src/extras/Controls.js +112 -0
- package/src/extras/DataUtils.d.ts +22 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.d.ts +17 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.d.ts +33 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.d.ts +95 -0
- package/src/extras/PMREMGenerator.js +770 -0
- package/src/extras/ShapeUtils.d.ts +25 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.d.ts +42 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.d.ts +162 -0
- package/src/extras/core/Curve.js +521 -0
- package/src/extras/core/CurvePath.d.ts +77 -0
- package/src/extras/core/CurvePath.js +309 -0
- package/src/extras/core/Interpolations.d.ts +36 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.d.ts +166 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.d.ts +86 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.d.ts +94 -0
- package/src/extras/core/ShapePath.js +356 -0
- package/src/extras/curves/ArcCurve.d.ts +41 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.d.ts +77 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.d.ts +72 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.d.ts +72 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.d.ts +10 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.d.ts +115 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.d.ts +42 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.d.ts +42 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.d.ts +64 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.d.ts +64 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.d.ts +52 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.d.ts +59 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.d.ts +56 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.d.ts +51 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.d.ts +64 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.d.ts +64 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.d.ts +25 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.d.ts +41 -0
- package/src/geometries/EdgesGeometry.js +182 -0
- package/src/geometries/ExtrudeGeometry.d.ts +138 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.d.ts +21 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.d.ts +26 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.d.ts +55 -0
- package/src/geometries/LatheGeometry.js +232 -0
- package/src/geometries/OctahedronGeometry.d.ts +25 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.d.ts +48 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.d.ts +54 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.d.ts +59 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.d.ts +53 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.d.ts +67 -0
- package/src/geometries/SphereGeometry.js +180 -0
- package/src/geometries/TetrahedronGeometry.d.ts +25 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.d.ts +69 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.d.ts +59 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.d.ts +86 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.d.ts +40 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.d.ts +72 -0
- package/src/helpers/ArrowHelper.js +173 -0
- package/src/helpers/AxesHelper.d.ts +33 -0
- package/src/helpers/AxesHelper.js +98 -0
- package/src/helpers/Box3Helper.d.ts +28 -0
- package/src/helpers/Box3Helper.js +85 -0
- package/src/helpers/BoxHelper.d.ts +48 -0
- package/src/helpers/BoxHelper.js +151 -0
- package/src/helpers/CameraHelper.d.ts +54 -0
- package/src/helpers/CameraHelper.js +347 -0
- package/src/helpers/DirectionalLightHelper.d.ts +55 -0
- package/src/helpers/DirectionalLightHelper.js +152 -0
- package/src/helpers/GridHelper.d.ts +28 -0
- package/src/helpers/GridHelper.js +84 -0
- package/src/helpers/HemisphereLightHelper.d.ts +44 -0
- package/src/helpers/HemisphereLightHelper.js +134 -0
- package/src/helpers/PlaneHelper.d.ts +33 -0
- package/src/helpers/PlaneHelper.js +98 -0
- package/src/helpers/PointLightHelper.d.ts +43 -0
- package/src/helpers/PointLightHelper.js +115 -0
- package/src/helpers/PolarGridHelper.d.ts +37 -0
- package/src/helpers/PolarGridHelper.js +128 -0
- package/src/helpers/SkeletonHelper.d.ts +44 -0
- package/src/helpers/SkeletonHelper.js +196 -0
- package/src/helpers/SpotLightHelper.d.ts +45 -0
- package/src/helpers/SpotLightHelper.js +156 -0
- package/src/lights/AmbientLight.d.ts +28 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.d.ts +68 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.d.ts +18 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.d.ts +41 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.d.ts +39 -0
- package/src/lights/Light.js +86 -0
- package/src/lights/LightProbe.d.ts +46 -0
- package/src/lights/LightProbe.js +77 -0
- package/src/lights/LightShadow.d.ts +201 -0
- package/src/lights/LightShadow.js +380 -0
- package/src/lights/PointLight.d.ts +72 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.d.ts +18 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.d.ts +62 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.d.ts +124 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.d.ts +44 -0
- package/src/lights/SpotLightShadow.js +98 -0
- package/src/lights/webgpu/IESSpotLight.d.ts +18 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.d.ts +16 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.d.ts +9 -0
- package/src/loaders/AnimationLoader.js +100 -0
- package/src/loaders/AudioLoader.d.ts +6 -0
- package/src/loaders/AudioLoader.js +110 -0
- package/src/loaders/BufferGeometryLoader.d.ts +10 -0
- package/src/loaders/BufferGeometryLoader.js +249 -0
- package/src/loaders/Cache.d.ts +21 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.d.ts +14 -0
- package/src/loaders/CompressedTextureLoader.js +169 -0
- package/src/loaders/CubeTextureLoader.d.ts +14 -0
- package/src/loaders/CubeTextureLoader.js +105 -0
- package/src/loaders/DataTextureLoader.d.ts +48 -0
- package/src/loaders/DataTextureLoader.js +207 -0
- package/src/loaders/FileLoader.d.ts +19 -0
- package/src/loaders/FileLoader.js +369 -0
- package/src/loaders/ImageBitmapLoader.d.ts +22 -0
- package/src/loaders/ImageBitmapLoader.js +227 -0
- package/src/loaders/ImageLoader.d.ts +17 -0
- package/src/loaders/ImageLoader.js +169 -0
- package/src/loaders/Loader.d.ts +51 -0
- package/src/loaders/Loader.js +269 -0
- package/src/loaders/LoaderUtils.d.ts +5 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.d.ts +73 -0
- package/src/loaders/LoadingManager.js +334 -0
- package/src/loaders/MaterialLoader.d.ts +29 -0
- package/src/loaders/MaterialLoader.js +211 -0
- package/src/loaders/ObjectLoader.d.ts +35 -0
- package/src/loaders/ObjectLoader.js +1328 -0
- package/src/loaders/TextureLoader.d.ts +18 -0
- package/src/loaders/TextureLoader.js +76 -0
- package/src/loaders/nodes/NodeLoader.d.ts +21 -0
- package/src/loaders/nodes/NodeLoader.js +196 -0
- package/src/loaders/nodes/NodeMaterialLoader.d.ts +11 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.d.ts +22 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.d.ts +93 -0
- package/src/materials/LineBasicMaterial.js +126 -0
- package/src/materials/LineDashedMaterial.d.ts +56 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.d.ts +663 -0
- package/src/materials/Material.js +1254 -0
- package/src/materials/Materials.d.ts +18 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.d.ts +204 -0
- package/src/materials/MeshBasicMaterial.js +274 -0
- package/src/materials/MeshDepthMaterial.d.ts +119 -0
- package/src/materials/MeshDepthMaterial.js +158 -0
- package/src/materials/MeshDistanceMaterial.d.ts +102 -0
- package/src/materials/MeshDistanceMaterial.js +129 -0
- package/src/materials/MeshLambertMaterial.d.ts +331 -0
- package/src/materials/MeshLambertMaterial.js +441 -0
- package/src/materials/MeshMatcapMaterial.d.ts +199 -0
- package/src/materials/MeshMatcapMaterial.js +269 -0
- package/src/materials/MeshNormalMaterial.d.ts +134 -0
- package/src/materials/MeshNormalMaterial.js +183 -0
- package/src/materials/MeshPhongMaterial.d.ts +343 -0
- package/src/materials/MeshPhongMaterial.js +460 -0
- package/src/materials/MeshPhysicalMaterial.d.ts +353 -0
- package/src/materials/MeshPhysicalMaterial.js +685 -0
- package/src/materials/MeshStandardMaterial.d.ts +352 -0
- package/src/materials/MeshStandardMaterial.js +466 -0
- package/src/materials/MeshToonMaterial.d.ts +265 -0
- package/src/materials/MeshToonMaterial.js +354 -0
- package/src/materials/PointsMaterial.d.ts +113 -0
- package/src/materials/PointsMaterial.js +146 -0
- package/src/materials/RawShaderMaterial.d.ts +17 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.d.ts +268 -0
- package/src/materials/ShaderMaterial.js +499 -0
- package/src/materials/ShadowMaterial.d.ts +61 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.d.ts +100 -0
- package/src/materials/SpriteMaterial.js +143 -0
- package/src/materials/nodes/Line2NodeMaterial.d.ts +102 -0
- package/src/materials/nodes/Line2NodeMaterial.js +656 -0
- package/src/materials/nodes/LineBasicNodeMaterial.d.ts +38 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.d.ts +88 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.d.ts +55 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.d.ts +55 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +95 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.d.ts +41 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.d.ts +77 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +145 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +286 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +563 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.d.ts +110 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +162 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.d.ts +93 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +176 -0
- package/src/materials/nodes/MeshToonNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +79 -0
- package/src/materials/nodes/NodeMaterial.d.ts +503 -0
- package/src/materials/nodes/NodeMaterial.js +1400 -0
- package/src/materials/nodes/NodeMaterialInstance.js +193 -0
- package/src/materials/nodes/NodeMaterials.d.ts +18 -0
- package/src/materials/nodes/NodeMaterials.js +22 -0
- package/src/materials/nodes/PointsNodeMaterial.d.ts +60 -0
- package/src/materials/nodes/PointsNodeMaterial.js +212 -0
- package/src/materials/nodes/ShadowNodeMaterial.d.ts +45 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.d.ts +74 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +176 -0
- package/src/materials/nodes/VolumeNodeMaterial.d.ts +56 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.d.ts +58 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +1142 -0
- package/src/math/Box2.d.ts +48 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.d.ts +310 -0
- package/src/math/Box3.js +810 -0
- package/src/math/Color.d.ts +376 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.d.ts +59 -0
- package/src/math/ColorManagement.js +196 -0
- package/src/math/Cylindrical.d.ts +26 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.d.ts +50 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.d.ts +30 -0
- package/src/math/Frustum.js +294 -0
- package/src/math/FrustumArray.d.ts +86 -0
- package/src/math/FrustumArray.js +240 -0
- package/src/math/Interpolant.d.ts +113 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.d.ts +30 -0
- package/src/math/Line3.js +335 -0
- package/src/math/MathUtils.d.ts +153 -0
- package/src/math/MathUtils.js +740 -0
- package/src/math/Matrix2.d.ts +53 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.d.ts +193 -0
- package/src/math/Matrix3.js +628 -0
- package/src/math/Matrix4.d.ts +506 -0
- package/src/math/Matrix4.js +1332 -0
- package/src/math/Plane.d.ts +55 -0
- package/src/math/Plane.js +397 -0
- package/src/math/Quaternion.d.ts +189 -0
- package/src/math/Quaternion.js +908 -0
- package/src/math/Ray.d.ts +60 -0
- package/src/math/Ray.js +705 -0
- package/src/math/Sphere.d.ts +55 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.d.ts +27 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.d.ts +50 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.d.ts +110 -0
- package/src/math/Triangle.js +538 -0
- package/src/math/Vector2.d.ts +321 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.d.ts +301 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.d.ts +241 -0
- package/src/math/Vector4.js +1063 -0
- package/src/math/interpolants/BezierInterpolant.d.ts +23 -0
- package/src/math/interpolants/BezierInterpolant.js +119 -0
- package/src/math/interpolants/CubicInterpolant.d.ts +22 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.d.ts +12 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.d.ts +11 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.d.ts +11 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.d.ts +170 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.d.ts +183 -0
- package/src/nodes/TSL.js +185 -0
- package/src/nodes/accessors/AccessorsUtils.d.ts +8 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.d.ts +22 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/Batch.d.ts +25 -0
- package/src/nodes/accessors/Batch.js +186 -0
- package/src/nodes/accessors/Bitangent.d.ts +6 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.d.ts +247 -0
- package/src/nodes/accessors/BufferAttributeNode.js +472 -0
- package/src/nodes/accessors/BufferNode.d.ts +33 -0
- package/src/nodes/accessors/BufferNode.js +138 -0
- package/src/nodes/accessors/BuiltinNode.d.ts +13 -0
- package/src/nodes/accessors/BuiltinNode.js +69 -0
- package/src/nodes/accessors/Camera.d.ts +16 -0
- package/src/nodes/accessors/Camera.js +410 -0
- package/src/nodes/accessors/ClippingNode.d.ts +19 -0
- package/src/nodes/accessors/ClippingNode.js +266 -0
- package/src/nodes/accessors/CubeTextureNode.d.ts +38 -0
- package/src/nodes/accessors/CubeTextureNode.js +203 -0
- package/src/nodes/accessors/Instance.d.ts +32 -0
- package/src/nodes/accessors/Instance.js +387 -0
- package/src/nodes/accessors/Lights.d.ts +17 -0
- package/src/nodes/accessors/Lights.js +152 -0
- package/src/nodes/accessors/MaterialNode.d.ts +134 -0
- package/src/nodes/accessors/MaterialNode.js +837 -0
- package/src/nodes/accessors/MaterialProperties.d.ts +8 -0
- package/src/nodes/accessors/MaterialProperties.js +57 -0
- package/src/nodes/accessors/MaterialReferenceNode.d.ts +15 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.d.ts +49 -0
- package/src/nodes/accessors/ModelNode.js +260 -0
- package/src/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/Morph.d.ts +11 -0
- package/src/nodes/accessors/Morph.js +356 -0
- package/src/nodes/accessors/Normal.d.ts +36 -0
- package/src/nodes/accessors/Normal.js +201 -0
- package/src/nodes/accessors/Object3DNode.d.ts +42 -0
- package/src/nodes/accessors/Object3DNode.js +274 -0
- package/src/nodes/accessors/PointUVNode.d.ts +9 -0
- package/src/nodes/accessors/PointUVNode.js +61 -0
- package/src/nodes/accessors/Position.d.ts +11 -0
- package/src/nodes/accessors/Position.js +126 -0
- package/src/nodes/accessors/ReferenceAttributeNode.js +279 -0
- package/src/nodes/accessors/ReferenceBaseNode.d.ts +26 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +294 -0
- package/src/nodes/accessors/ReferenceElementNode.d.ts +15 -0
- package/src/nodes/accessors/ReferenceElementNode.js +72 -0
- package/src/nodes/accessors/ReferenceNode.d.ts +37 -0
- package/src/nodes/accessors/ReferenceNode.js +362 -0
- package/src/nodes/accessors/ReflectVector.d.ts +7 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.d.ts +14 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.d.ts +5 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/Skinning.d.ts +23 -0
- package/src/nodes/accessors/Skinning.js +380 -0
- package/src/nodes/accessors/StorageBufferNode.d.ts +82 -0
- package/src/nodes/accessors/StorageBufferNode.js +396 -0
- package/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.d.ts +47 -0
- package/src/nodes/accessors/StorageTextureNode.js +331 -0
- package/src/nodes/accessors/Tangent.d.ts +6 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.d.ts +21 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.d.ts +29 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.d.ts +6 -0
- package/src/nodes/accessors/TextureBicubic.js +95 -0
- package/src/nodes/accessors/TextureNode.d.ts +104 -0
- package/src/nodes/accessors/TextureNode.js +1142 -0
- package/src/nodes/accessors/TextureSizeNode.d.ts +17 -0
- package/src/nodes/accessors/TextureSizeNode.js +85 -0
- package/src/nodes/accessors/UV.d.ts +3 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.d.ts +29 -0
- package/src/nodes/accessors/UniformArrayNode.js +368 -0
- package/src/nodes/accessors/UserDataNode.d.ts +14 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.d.ts +19 -0
- package/src/nodes/accessors/VelocityNode.js +229 -0
- package/src/nodes/accessors/VertexColorNode.d.ts +11 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.d.ts +22 -0
- package/src/nodes/code/CodeNode.js +187 -0
- package/src/nodes/code/ExpressionNode.d.ts +9 -0
- package/src/nodes/code/ExpressionNode.js +74 -0
- package/src/nodes/code/FunctionCallNode.d.ts +27 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.d.ts +40 -0
- package/src/nodes/code/FunctionNode.js +180 -0
- package/src/nodes/core/ArrayNode.d.ts +33 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.d.ts +15 -0
- package/src/nodes/core/AssignNode.js +203 -0
- package/src/nodes/core/AttributeNode.d.ts +21 -0
- package/src/nodes/core/AttributeNode.js +207 -0
- package/src/nodes/core/BypassNode.d.ts +17 -0
- package/src/nodes/core/BypassNode.js +99 -0
- package/src/nodes/core/ConstNode.d.ts +16 -0
- package/src/nodes/core/ConstNode.js +97 -0
- package/src/nodes/core/ContextNode.d.ts +65 -0
- package/src/nodes/core/ContextNode.js +341 -0
- package/src/nodes/core/IndexNode.d.ts +33 -0
- package/src/nodes/core/IndexNode.js +236 -0
- package/src/nodes/core/InputNode.d.ts +23 -0
- package/src/nodes/core/InputNode.js +142 -0
- package/src/nodes/core/InspectorNode.d.ts +15 -0
- package/src/nodes/core/InspectorNode.js +114 -0
- package/src/nodes/core/IsolateNode.d.ts +31 -0
- package/src/nodes/core/IsolateNode.js +141 -0
- package/src/nodes/core/LightingModel.d.ts +33 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.d.ts +38 -0
- package/src/nodes/core/MRTNode.js +243 -0
- package/src/nodes/core/Node.d.ts +622 -0
- package/src/nodes/core/Node.js +1520 -0
- package/src/nodes/core/NodeAttribute.d.ts +47 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.d.ts +25 -0
- package/src/nodes/core/NodeBuilder.js +3918 -0
- package/src/nodes/core/NodeCache.d.ts +50 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.d.ts +4 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.d.ts +9 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.d.ts +36 -0
- package/src/nodes/core/NodeFrame.js +322 -0
- package/src/nodes/core/NodeFunction.d.ts +13 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.d.ts +7 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.d.ts +18 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.d.ts +66 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.d.ts +26 -0
- package/src/nodes/core/NodeUtils.js +521 -0
- package/src/nodes/core/NodeVar.d.ts +51 -0
- package/src/nodes/core/NodeVar.js +69 -0
- package/src/nodes/core/NodeVarying.d.ts +59 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.d.ts +11 -0
- package/src/nodes/core/OutputStructNode.js +111 -0
- package/src/nodes/core/OverrideContextNode.d.ts +92 -0
- package/src/nodes/core/OverrideContextNode.js +154 -0
- package/src/nodes/core/ParameterNode.d.ts +18 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.d.ts +66 -0
- package/src/nodes/core/PropertyNode.js +435 -0
- package/src/nodes/core/StackNode.d.ts +25 -0
- package/src/nodes/core/StackNode.js +459 -0
- package/src/nodes/core/StackTrace.d.ts +9 -0
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.d.ts +37 -0
- package/src/nodes/core/StructNode.js +139 -0
- package/src/nodes/core/StructType.d.ts +10 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.d.ts +57 -0
- package/src/nodes/core/StructTypeNode.js +154 -0
- package/src/nodes/core/SubBuildNode.d.ts +14 -0
- package/src/nodes/core/SubBuildNode.js +97 -0
- package/src/nodes/core/TempNode.d.ts +16 -0
- package/src/nodes/core/TempNode.js +63 -0
- package/src/nodes/core/UniformGroupNode.d.ts +22 -0
- package/src/nodes/core/UniformGroupNode.js +174 -0
- package/src/nodes/core/UniformNode.d.ts +162 -0
- package/src/nodes/core/UniformNode.js +273 -0
- package/src/nodes/core/VarNode.d.ts +45 -0
- package/src/nodes/core/VarNode.js +282 -0
- package/src/nodes/core/VaryingNode.d.ts +36 -0
- package/src/nodes/core/VaryingNode.js +251 -0
- package/src/nodes/core/constants.d.ts +72 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.d.ts +76 -0
- package/src/nodes/display/BlendModes.js +96 -0
- package/src/nodes/display/BumpMapNode.d.ts +16 -0
- package/src/nodes/display/BumpMapNode.js +132 -0
- package/src/nodes/display/ColorAdjustment.d.ts +54 -0
- package/src/nodes/display/ColorAdjustment.js +171 -0
- package/src/nodes/display/ColorSpaceFunctions.d.ts +5 -0
- package/src/nodes/display/ColorSpaceFunctions.js +42 -0
- package/src/nodes/display/ColorSpaceNode.d.ts +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.d.ts +71 -0
- package/src/nodes/display/FrontFacingNode.js +137 -0
- package/src/nodes/display/NormalMapNode.d.ts +18 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.d.ts +124 -0
- package/src/nodes/display/PassNode.js +1167 -0
- package/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.d.ts +29 -0
- package/src/nodes/display/RenderOutputNode.js +176 -0
- package/src/nodes/display/ScreenNode.d.ts +44 -0
- package/src/nodes/display/ScreenNode.js +255 -0
- package/src/nodes/display/ToneMappingFunctions.d.ts +13 -0
- package/src/nodes/display/ToneMappingFunctions.js +200 -0
- package/src/nodes/display/ToneMappingNode.d.ts +29 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.d.ts +23 -0
- package/src/nodes/display/ToonOutlinePassNode.js +255 -0
- package/src/nodes/display/ViewportDepthNode.d.ts +41 -0
- package/src/nodes/display/ViewportDepthNode.js +372 -0
- package/src/nodes/display/ViewportDepthTextureNode.d.ts +14 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.d.ts +16 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.d.ts +33 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.d.ts +27 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_EON.js +65 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.d.ts +15 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +57 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +6 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/src/nodes/functions/BSDF/DFGLUT.d.ts +13 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +57 -0
- package/src/nodes/functions/BSDF/D_GGX.d.ts +9 -0
- package/src/nodes/functions/BSDF/D_GGX.js +16 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +9 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +25 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts +8 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.d.ts +13 -0
- package/src/nodes/functions/BSDF/LTC.js +148 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +9 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +13 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +10 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +18 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +15 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +26 -0
- package/src/nodes/functions/BasicLightingModel.d.ts +7 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.d.ts +7 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.d.ts +40 -0
- package/src/nodes/functions/PhysicalLightingModel.js +969 -0
- package/src/nodes/functions/ShadowMaskModel.d.ts +8 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.d.ts +4 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
- package/src/nodes/functions/VolumetricLightingModel.js +216 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.d.ts +5 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +62 -0
- package/src/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +9 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +36 -0
- package/src/nodes/functions/material/getRoughness.d.ts +6 -0
- package/src/nodes/functions/material/getRoughness.js +20 -0
- package/src/nodes/functions/material/getShIrradianceAt.d.ts +5 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.d.ts +62 -0
- package/src/nodes/geometry/RangeNode.js +193 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.d.ts +91 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +330 -0
- package/src/nodes/gpgpu/BarrierNode.d.ts +15 -0
- package/src/nodes/gpgpu/BarrierNode.js +113 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +22 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +233 -0
- package/src/nodes/gpgpu/ComputeNode.d.ts +50 -0
- package/src/nodes/gpgpu/ComputeNode.js +319 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +99 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +592 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +24 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +278 -0
- package/src/nodes/lighting/AONode.d.ts +8 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.d.ts +8 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.d.ts +32 -0
- package/src/nodes/lighting/AnalyticLightNode.js +302 -0
- package/src/nodes/lighting/BasicEnvironmentNode.d.ts +10 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +53 -0
- package/src/nodes/lighting/BasicLightMapNode.d.ts +8 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.d.ts +8 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.d.ts +8 -0
- package/src/nodes/lighting/EnvironmentNode.js +264 -0
- package/src/nodes/lighting/HemisphereLightNode.d.ts +14 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.d.ts +5 -0
- package/src/nodes/lighting/IESSpotLightNode.js +102 -0
- package/src/nodes/lighting/IrradianceNode.d.ts +8 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.d.ts +11 -0
- package/src/nodes/lighting/LightProbeNode.js +74 -0
- package/src/nodes/lighting/LightUtils.d.ts +8 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.d.ts +41 -0
- package/src/nodes/lighting/LightingContextNode.js +123 -0
- package/src/nodes/lighting/LightingNode.d.ts +7 -0
- package/src/nodes/lighting/LightingNode.js +42 -0
- package/src/nodes/lighting/LightsNode.d.ts +48 -0
- package/src/nodes/lighting/LightsNode.js +495 -0
- package/src/nodes/lighting/PointLightNode.d.ts +23 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.d.ts +25 -0
- package/src/nodes/lighting/PointShadowNode.js +374 -0
- package/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.d.ts +21 -0
- package/src/nodes/lighting/RectAreaLightNode.js +132 -0
- package/src/nodes/lighting/ShadowBaseNode.d.ts +47 -0
- package/src/nodes/lighting/ShadowBaseNode.js +230 -0
- package/src/nodes/lighting/ShadowFilterNode.d.ts +17 -0
- package/src/nodes/lighting/ShadowFilterNode.js +152 -0
- package/src/nodes/lighting/ShadowNode.d.ts +11 -0
- package/src/nodes/lighting/ShadowNode.js +843 -0
- package/src/nodes/lighting/SpotLightNode.d.ts +22 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXColor.d.ts +5 -0
- package/src/nodes/materialx/MaterialXColor.js +112 -0
- package/src/nodes/materialx/MaterialXColorTransform.d.ts +3 -0
- package/src/nodes/materialx/MaterialXColorTransform.js +14 -0
- package/src/nodes/materialx/MaterialXCore.d.ts +5 -0
- package/src/nodes/materialx/MaterialXCore.js +37 -0
- package/src/nodes/materialx/MaterialXNodes.d.ts +206 -0
- package/src/nodes/materialx/MaterialXNodes.js +186 -0
- package/src/nodes/materialx/MaterialXNoise.d.ts +415 -0
- package/src/nodes/materialx/MaterialXNoise.js +1461 -0
- package/src/nodes/math/BitcastNode.d.ts +24 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.d.ts +23 -0
- package/src/nodes/math/BitcountNode.js +425 -0
- package/src/nodes/math/ConditionalNode.d.ts +51 -0
- package/src/nodes/math/ConditionalNode.js +315 -0
- package/src/nodes/math/Hash.d.ts +3 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.d.ts +895 -0
- package/src/nodes/math/MathNode.js +1252 -0
- package/src/nodes/math/MathUtils.d.ts +10 -0
- package/src/nodes/math/MathUtils.js +65 -0
- package/src/nodes/math/OperatorNode.d.ts +709 -0
- package/src/nodes/math/OperatorNode.js +735 -0
- package/src/nodes/math/PackFloatNode.d.ts +24 -0
- package/src/nodes/math/PackFloatNode.js +126 -0
- package/src/nodes/math/Packed4x8IntegerNode.d.ts +49 -0
- package/src/nodes/math/Packed4x8IntegerNode.js +401 -0
- package/src/nodes/math/TriNoise3D.d.ts +11 -0
- package/src/nodes/math/TriNoise3D.js +51 -0
- package/src/nodes/math/UnpackFloatNode.d.ts +21 -0
- package/src/nodes/math/UnpackFloatNode.js +124 -0
- package/src/nodes/parsers/GLSLNodeFunction.d.ts +9 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.d.ts +8 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.d.ts +21 -0
- package/src/nodes/pmrem/PMREMNode.js +391 -0
- package/src/nodes/pmrem/PMREMUtils.d.ts +21 -0
- package/src/nodes/pmrem/PMREMUtils.js +190 -0
- package/src/nodes/procedural/Checker.d.ts +3 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.d.ts +3 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.d.ts +30 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.d.ts +2420 -0
- package/src/nodes/tsl/TSLCore.js +1390 -0
- package/src/nodes/utils/ArrayElementNode.d.ts +15 -0
- package/src/nodes/utils/ArrayElementNode.js +108 -0
- package/src/nodes/utils/ConvertNode.d.ts +14 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.d.ts +12 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.d.ts +22 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.d.ts +10 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.d.ts +33 -0
- package/src/nodes/utils/EquirectUV.js +52 -0
- package/src/nodes/utils/EventNode.d.ts +41 -0
- package/src/nodes/utils/EventNode.js +229 -0
- package/src/nodes/utils/FlipNode.d.ts +11 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.d.ts +12 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +176 -0
- package/src/nodes/utils/JoinNode.d.ts +14 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.d.ts +43 -0
- package/src/nodes/utils/LoopNode.js +395 -0
- package/src/nodes/utils/MatcapUV.d.ts +3 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.d.ts +13 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.d.ts +11 -0
- package/src/nodes/utils/MemberNode.js +138 -0
- package/src/nodes/utils/Oscillators.d.ts +6 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.d.ts +52 -0
- package/src/nodes/utils/Packing.js +64 -0
- package/src/nodes/utils/PostProcessingUtils.d.ts +56 -0
- package/src/nodes/utils/PostProcessingUtils.js +170 -0
- package/src/nodes/utils/RTTNode.d.ts +46 -0
- package/src/nodes/utils/RTTNode.js +372 -0
- package/src/nodes/utils/ReflectorNode.d.ts +61 -0
- package/src/nodes/utils/ReflectorNode.js +658 -0
- package/src/nodes/utils/Remap.d.ts +223 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.d.ts +26 -0
- package/src/nodes/utils/RotateNode.js +180 -0
- package/src/nodes/utils/SampleNode.d.ts +26 -0
- package/src/nodes/utils/SampleNode.js +97 -0
- package/src/nodes/utils/SetNode.d.ts +11 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.d.ts +14 -0
- package/src/nodes/utils/SplitNode.js +185 -0
- package/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.d.ts +5 -0
- package/src/nodes/utils/SpriteUtils.js +98 -0
- package/src/nodes/utils/StorageArrayElementNode.d.ts +28 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.d.ts +5 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.d.ts +19 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.d.ts +19 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.d.ts +3 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.d.ts +280 -0
- package/src/objects/BatchedMesh.js +1827 -0
- package/src/objects/Bone.d.ts +36 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.d.ts +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.d.ts +37 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.d.ts +175 -0
- package/src/objects/InstancedMesh.js +419 -0
- package/src/objects/LOD.d.ts +112 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.d.ts +96 -0
- package/src/objects/Line.js +361 -0
- package/src/objects/LineLoop.d.ts +40 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.d.ts +41 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.d.ts +111 -0
- package/src/objects/Mesh.js +516 -0
- package/src/objects/Points.d.ts +75 -0
- package/src/objects/Points.js +260 -0
- package/src/objects/Skeleton.d.ts +120 -0
- package/src/objects/Skeleton.js +409 -0
- package/src/objects/SkinnedMesh.d.ts +163 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.d.ts +82 -0
- package/src/objects/Sprite.js +267 -0
- package/src/renderers/WebGL3DRenderTarget.d.ts +29 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.d.ts +29 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.d.ts +18 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.d.ts +8 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.d.ts +489 -0
- package/src/renderers/WebGLRenderer.js +3803 -0
- package/src/renderers/common/Animation.js +173 -0
- package/src/renderers/common/Attributes.js +197 -0
- package/src/renderers/common/Backend.d.ts +29 -0
- package/src/renderers/common/Backend.js +916 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +56 -0
- package/src/renderers/common/Binding.js +60 -0
- package/src/renderers/common/Bindings.js +641 -0
- package/src/renderers/common/BlendMode.d.ts +22 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +136 -0
- package/src/renderers/common/BufferUtils.d.ts +28 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.d.ts +46 -0
- package/src/renderers/common/BundleGroup.js +87 -0
- package/src/renderers/common/CanvasTarget.d.ts +158 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/CapabilityTier.js +18 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.d.ts +134 -0
- package/src/renderers/common/ClippingContext.js +291 -0
- package/src/renderers/common/Color4.d.ts +53 -0
- package/src/renderers/common/Color4.js +86 -0
- package/src/renderers/common/ComputePipeline.js +57 -0
- package/src/renderers/common/Constants.d.ts +9 -0
- package/src/renderers/common/Constants.js +10 -0
- package/src/renderers/common/CubeRenderTarget.d.ts +47 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/DirectRenderPipeline.d.ts +20 -0
- package/src/renderers/common/DirectRenderPipeline.js +237 -0
- package/src/renderers/common/GPUInstanceCuller.d.ts +43 -0
- package/src/renderers/common/GPUInstanceCuller.js +372 -0
- package/src/renderers/common/GPUTimings.js +66 -0
- package/src/renderers/common/Geometries.js +523 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.d.ts +194 -0
- package/src/renderers/common/Info.js +542 -0
- package/src/renderers/common/InspectorBase.d.ts +129 -0
- package/src/renderers/common/InspectorBase.js +180 -0
- package/src/renderers/common/Lighting.d.ts +55 -0
- package/src/renderers/common/Lighting.js +171 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +514 -0
- package/src/renderers/common/PostProcessing.d.ts +21 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +62 -0
- package/src/renderers/common/QuadMesh.d.ts +19 -0
- package/src/renderers/common/QuadMesh.js +126 -0
- package/src/renderers/common/ReadbackBuffer.d.ts +63 -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 +310 -0
- package/src/renderers/common/RenderContexts.js +109 -0
- package/src/renderers/common/RenderList.js +475 -0
- package/src/renderers/common/RenderLists.js +125 -0
- package/src/renderers/common/RenderObject.js +1065 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +263 -0
- package/src/renderers/common/RenderPipeline.d.ts +26 -0
- package/src/renderers/common/RenderPipeline.js +263 -0
- package/src/renderers/common/Renderer.d.ts +1209 -0
- package/src/renderers/common/Renderer.js +4357 -0
- package/src/renderers/common/RendererUtils.d.ts +77 -0
- package/src/renderers/common/RendererUtils.js +215 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +133 -0
- package/src/renderers/common/StandardDrawingPipeline.js +343 -0
- package/src/renderers/common/Storage3DTexture.d.ts +42 -0
- package/src/renderers/common/Storage3DTexture.js +127 -0
- package/src/renderers/common/StorageArrayTexture.d.ts +31 -0
- package/src/renderers/common/StorageArrayTexture.js +94 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.d.ts +7 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.d.ts +8 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.d.ts +7 -0
- package/src/renderers/common/StorageTexture.js +77 -0
- package/src/renderers/common/Textures.js +763 -0
- package/src/renderers/common/TimestampQueryPool.d.ts +120 -0
- package/src/renderers/common/TimestampQueryPool.js +173 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +589 -0
- package/src/renderers/common/XRManager.d.ts +293 -0
- package/src/renderers/common/XRManager.js +1928 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.d.ts +52 -0
- package/src/renderers/common/extras/PMREMGenerator.js +673 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +162 -0
- package/src/renderers/common/nodes/NodeLibrary.d.ts +129 -0
- package/src/renderers/common/nodes/NodeLibrary.js +172 -0
- package/src/renderers/common/nodes/NodeManager.js +1219 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +154 -0
- package/src/renderers/common/nodes/NodeSampler.js +76 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +74 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +107 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +50 -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 +134 -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 +59 -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 +23 -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 +117 -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 +92 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +281 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +62 -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 +236 -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 +183 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +757 -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 +33 -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 +20 -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 +474 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +85 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +81 -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 +124 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +151 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +127 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.d.ts +144 -0
- package/src/renderers/shaders/ShaderChunk.js +270 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +48 -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 +125 -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 +127 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +235 -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.d.ts +29 -0
- package/src/renderers/shaders/ShaderLib.js +366 -0
- package/src/renderers/shaders/UniformsLib.d.ts +209 -0
- package/src/renderers/shaders/UniformsLib.js +249 -0
- package/src/renderers/shaders/UniformsUtils.d.ts +14 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.d.ts +23 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.d.ts +26 -0
- package/src/renderers/webgl/WebGLBindingStates.js +668 -0
- package/src/renderers/webgl/WebGLBufferRenderer.d.ts +15 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.d.ts +48 -0
- package/src/renderers/webgl/WebGLCapabilities.js +156 -0
- package/src/renderers/webgl/WebGLClipping.d.ts +26 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.d.ts +7 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.d.ts +13 -0
- package/src/renderers/webgl/WebGLGeometries.js +214 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +13 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.d.ts +39 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.d.ts +57 -0
- package/src/renderers/webgl/WebGLLights.js +654 -0
- package/src/renderers/webgl/WebGLMaterials.js +621 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.d.ts +19 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +319 -0
- package/src/renderers/webgl/WebGLProgram.d.ts +22 -0
- package/src/renderers/webgl/WebGLProgram.js +994 -0
- package/src/renderers/webgl/WebGLPrograms.d.ts +242 -0
- package/src/renderers/webgl/WebGLPrograms.js +708 -0
- package/src/renderers/webgl/WebGLProperties.d.ts +9 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.d.ts +68 -0
- package/src/renderers/webgl/WebGLRenderLists.js +257 -0
- package/src/renderers/webgl/WebGLRenderStates.js +127 -0
- package/src/renderers/webgl/WebGLShader.d.ts +1 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +118 -0
- package/src/renderers/webgl/WebGLShadowMap.d.ts +33 -0
- package/src/renderers/webgl/WebGLShadowMap.js +613 -0
- package/src/renderers/webgl/WebGLState.d.ts +399 -0
- package/src/renderers/webgl/WebGLState.js +1374 -0
- package/src/renderers/webgl/WebGLTextures.d.ts +31 -0
- package/src/renderers/webgl/WebGLTextures.js +2571 -0
- package/src/renderers/webgl/WebGLUniforms.d.ts +5 -0
- package/src/renderers/webgl/WebGLUniforms.js +1241 -0
- package/src/renderers/webgl/WebGLUniformsGroups.d.ts +17 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +447 -0
- package/src/renderers/webgl/WebGLUtils.d.ts +11 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.d.ts +16 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2878 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +9 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1994 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +362 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +51 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +105 -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 +1532 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1461 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +406 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +319 -0
- package/src/renderers/webgl-fallback/utils/WebGLVertexArrayUtils.js +346 -0
- package/src/renderers/webgpu/WebGPUBackend.d.ts +32 -0
- package/src/renderers/webgpu/WebGPUBackend.js +3379 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.d.ts +17 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +13 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +91 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +99 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +9 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2834 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +188 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +646 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +683 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +149 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.d.ts +348 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1010 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +452 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1920 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +337 -0
- package/src/renderers/webgpu/utils/WebGPUUniformArena.js +240 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +359 -0
- package/src/renderers/webxr/WebXRController.d.ts +67 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.d.ts +21 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.d.ts +89 -0
- package/src/renderers/webxr/WebXRManager.js +1041 -0
- package/src/scenes/Fog.d.ts +71 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.d.ts +61 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.d.ts +104 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.d.ts +51 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.d.ts +65 -0
- package/src/textures/CompressedArrayTexture.js +105 -0
- package/src/textures/CompressedCubeTexture.d.ts +13 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.d.ts +92 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.d.ts +40 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.d.ts +82 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.d.ts +94 -0
- package/src/textures/Data3DTexture.js +128 -0
- package/src/textures/DataArrayTexture.d.ts +123 -0
- package/src/textures/DataArrayTexture.js +150 -0
- package/src/textures/DataTexture.d.ts +112 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.d.ts +105 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.d.ts +14 -0
- package/src/textures/ExternalTexture.js +53 -0
- package/src/textures/FramebufferTexture.d.ts +67 -0
- package/src/textures/FramebufferTexture.js +96 -0
- package/src/textures/HTMLTexture.d.ts +27 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Texture.d.ts +565 -0
- package/src/textures/Texture.js +840 -0
- package/src/textures/TextureSource.d.ts +99 -0
- package/src/textures/TextureSource.js +261 -0
- package/src/textures/VideoFrameTexture.d.ts +27 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.d.ts +90 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/upe.d.ts +5 -0
- package/src/upe.js +17 -0
- package/src/utils.d.ts +36 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,3650 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BackSide,
|
|
3
|
+
BoxGeometry,
|
|
4
|
+
BufferAttribute,
|
|
5
|
+
BufferGeometry,
|
|
6
|
+
ClampToEdgeWrapping,
|
|
7
|
+
Color,
|
|
8
|
+
ColorManagement,
|
|
9
|
+
ConeGeometry,
|
|
10
|
+
CylinderGeometry,
|
|
11
|
+
DataTexture,
|
|
12
|
+
DoubleSide,
|
|
13
|
+
FileLoader,
|
|
14
|
+
Float32BufferAttribute,
|
|
15
|
+
FrontSide,
|
|
16
|
+
Group,
|
|
17
|
+
LineBasicMaterial,
|
|
18
|
+
LineSegments,
|
|
19
|
+
Loader,
|
|
20
|
+
LoaderUtils,
|
|
21
|
+
MathUtils,
|
|
22
|
+
Mesh,
|
|
23
|
+
MeshBasicMaterial,
|
|
24
|
+
MeshPhongMaterial,
|
|
25
|
+
Object3D,
|
|
26
|
+
OrthographicCamera,
|
|
27
|
+
PerspectiveCamera,
|
|
28
|
+
Points,
|
|
29
|
+
PointsMaterial,
|
|
30
|
+
Quaternion,
|
|
31
|
+
RepeatWrapping,
|
|
32
|
+
Scene,
|
|
33
|
+
ShapeUtils,
|
|
34
|
+
SphereGeometry,
|
|
35
|
+
SRGBColorSpace,
|
|
36
|
+
TextureLoader,
|
|
37
|
+
Vector2,
|
|
38
|
+
Vector3
|
|
39
|
+
} from 'three';
|
|
40
|
+
import chevrotain from '../libs/chevrotain.module.min.js';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A loader for the VRML format.
|
|
44
|
+
*
|
|
45
|
+
* ```js
|
|
46
|
+
* const loader = new VRMLLoader();
|
|
47
|
+
* const object = await loader.loadAsync( 'models/vrml/house.wrl' );
|
|
48
|
+
* scene.add( object );
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @augments Loader
|
|
52
|
+
* @three_import import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js';
|
|
53
|
+
*/
|
|
54
|
+
class VRMLLoader extends Loader {
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Constructs a new VRML loader.
|
|
58
|
+
*
|
|
59
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
60
|
+
*/
|
|
61
|
+
constructor( manager ) {
|
|
62
|
+
|
|
63
|
+
super( manager );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Starts loading from the given URL and passes the loaded VRML asset
|
|
69
|
+
* to the `onLoad()` callback.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
72
|
+
* @param {function(Scene)} onLoad - Executed when the loading process has been finished.
|
|
73
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
74
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
75
|
+
*/
|
|
76
|
+
load( url, onLoad, onProgress, onError ) {
|
|
77
|
+
|
|
78
|
+
const scope = this;
|
|
79
|
+
|
|
80
|
+
const path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
|
|
81
|
+
|
|
82
|
+
const loader = new FileLoader( scope.manager );
|
|
83
|
+
loader.setPriority( scope.priority );
|
|
84
|
+
loader.setCache( scope.cache );
|
|
85
|
+
loader.setPath( scope.path );
|
|
86
|
+
loader.setRequestHeader( scope.requestHeader );
|
|
87
|
+
loader.setWithCredentials( scope.withCredentials );
|
|
88
|
+
loader.load( url, function ( text ) {
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
|
|
92
|
+
onLoad( scope.parse( text, path ) );
|
|
93
|
+
|
|
94
|
+
} catch ( e ) {
|
|
95
|
+
|
|
96
|
+
if ( onError ) {
|
|
97
|
+
|
|
98
|
+
onError( e );
|
|
99
|
+
|
|
100
|
+
} else {
|
|
101
|
+
|
|
102
|
+
console.error( e );
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
scope.manager.itemError( url );
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}, onProgress, onError );
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Parses the given VRML data and returns the resulting scene.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} data - The raw VRML data as a string.
|
|
118
|
+
* @param {string} path - The URL base path.
|
|
119
|
+
* @return {Scene} The parsed scene.
|
|
120
|
+
*/
|
|
121
|
+
parse( data, path ) {
|
|
122
|
+
|
|
123
|
+
const nodeMap = {};
|
|
124
|
+
|
|
125
|
+
function generateVRMLTree( data ) {
|
|
126
|
+
|
|
127
|
+
// create lexer, parser and visitor
|
|
128
|
+
|
|
129
|
+
const tokenData = createTokens();
|
|
130
|
+
|
|
131
|
+
const lexer = new VRMLLexer( tokenData.tokens );
|
|
132
|
+
const parser = new VRMLParser( tokenData.tokenVocabulary );
|
|
133
|
+
const visitor = createVisitor( parser.getBaseCstVisitorConstructor() );
|
|
134
|
+
|
|
135
|
+
// lexing
|
|
136
|
+
|
|
137
|
+
const lexingResult = lexer.lex( data );
|
|
138
|
+
parser.input = lexingResult.tokens;
|
|
139
|
+
|
|
140
|
+
// parsing
|
|
141
|
+
|
|
142
|
+
const cstOutput = parser.vrml();
|
|
143
|
+
|
|
144
|
+
if ( parser.errors.length > 0 ) {
|
|
145
|
+
|
|
146
|
+
console.error( parser.errors );
|
|
147
|
+
|
|
148
|
+
throw Error( 'THREE.VRMLLoader: Parsing errors detected.' );
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// actions
|
|
153
|
+
|
|
154
|
+
const ast = visitor.visit( cstOutput );
|
|
155
|
+
|
|
156
|
+
return ast;
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function createTokens() {
|
|
161
|
+
|
|
162
|
+
const createToken = chevrotain.createToken;
|
|
163
|
+
|
|
164
|
+
// from http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics
|
|
165
|
+
|
|
166
|
+
const RouteIdentifier = createToken( { name: 'RouteIdentifier', pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/ } );
|
|
167
|
+
const Identifier = createToken( { name: 'Identifier', pattern: /[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]([^\0-\x20\x22\x27\x23\x2b\x2c\x2e\x5b\x5d\x5c\x7b\x7d])*/, longer_alt: RouteIdentifier } );
|
|
168
|
+
|
|
169
|
+
// from http://gun.teipir.gr/VRML-amgem/spec/part1/nodesRef.html
|
|
170
|
+
|
|
171
|
+
const nodeTypes = [
|
|
172
|
+
'Anchor', 'Billboard', 'Collision', 'Group', 'Transform', // grouping nodes
|
|
173
|
+
'Inline', 'LOD', 'Switch', // special groups
|
|
174
|
+
'PerspectiveCamera', 'OrthographicCamera',
|
|
175
|
+
'AudioClip', 'DirectionalLight', 'PointLight', 'Script', 'Shape', 'Sound', 'SpotLight', 'WorldInfo', // common nodes
|
|
176
|
+
'CylinderSensor', 'PlaneSensor', 'ProximitySensor', 'SphereSensor', 'TimeSensor', 'TouchSensor', 'VisibilitySensor', // sensors
|
|
177
|
+
'Box', 'Cone', 'Cylinder', 'ElevationGrid', 'Extrusion', 'IndexedFaceSet', 'IndexedLineSet', 'PointSet', 'Sphere', // geometries
|
|
178
|
+
'Color', 'Coordinate', 'Normal', 'TextureCoordinate', // geometric properties
|
|
179
|
+
'Appearance', 'FontStyle', 'ImageTexture', 'Material', 'MovieTexture', 'PixelTexture', 'TextureTransform', // appearance
|
|
180
|
+
'ColorInterpolator', 'CoordinateInterpolator', 'NormalInterpolator', 'OrientationInterpolator', 'PositionInterpolator', 'ScalarInterpolator', // interpolators
|
|
181
|
+
'Background', 'Fog', 'NavigationInfo', 'Viewpoint', // bindable nodes
|
|
182
|
+
'Text' // Text must be placed at the end of the regex so there are no matches for TextureTransform and TextureCoordinate
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
//
|
|
186
|
+
|
|
187
|
+
const Version = createToken( {
|
|
188
|
+
name: 'Version',
|
|
189
|
+
pattern: /#VRML.*/,
|
|
190
|
+
longer_alt: Identifier
|
|
191
|
+
} );
|
|
192
|
+
|
|
193
|
+
const NodeName = createToken( {
|
|
194
|
+
name: 'NodeName',
|
|
195
|
+
pattern: new RegExp( nodeTypes.join( '|' ) ),
|
|
196
|
+
longer_alt: Identifier
|
|
197
|
+
} );
|
|
198
|
+
|
|
199
|
+
const DEF = createToken( {
|
|
200
|
+
name: 'DEF',
|
|
201
|
+
pattern: /DEF/,
|
|
202
|
+
longer_alt: Identifier
|
|
203
|
+
} );
|
|
204
|
+
|
|
205
|
+
const USE = createToken( {
|
|
206
|
+
name: 'USE',
|
|
207
|
+
pattern: /USE/,
|
|
208
|
+
longer_alt: Identifier
|
|
209
|
+
} );
|
|
210
|
+
|
|
211
|
+
const ROUTE = createToken( {
|
|
212
|
+
name: 'ROUTE',
|
|
213
|
+
pattern: /ROUTE/,
|
|
214
|
+
longer_alt: Identifier
|
|
215
|
+
} );
|
|
216
|
+
|
|
217
|
+
const TO = createToken( {
|
|
218
|
+
name: 'TO',
|
|
219
|
+
pattern: /TO/,
|
|
220
|
+
longer_alt: Identifier
|
|
221
|
+
} );
|
|
222
|
+
|
|
223
|
+
//
|
|
224
|
+
|
|
225
|
+
const StringLiteral = createToken( { name: 'StringLiteral', pattern: /"(?:[^\\"]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/ } );
|
|
226
|
+
const HexLiteral = createToken( { name: 'HexLiteral', pattern: /0[xX][0-9a-fA-F]+/ } );
|
|
227
|
+
const NumberLiteral = createToken( { name: 'NumberLiteral', pattern: /[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/ } );
|
|
228
|
+
const TrueLiteral = createToken( { name: 'TrueLiteral', pattern: /TRUE/ } );
|
|
229
|
+
const FalseLiteral = createToken( { name: 'FalseLiteral', pattern: /FALSE/ } );
|
|
230
|
+
const NullLiteral = createToken( { name: 'NullLiteral', pattern: /NULL/ } );
|
|
231
|
+
const LSquare = createToken( { name: 'LSquare', pattern: /\[/ } );
|
|
232
|
+
const RSquare = createToken( { name: 'RSquare', pattern: /]/ } );
|
|
233
|
+
const LCurly = createToken( { name: 'LCurly', pattern: /{/ } );
|
|
234
|
+
const RCurly = createToken( { name: 'RCurly', pattern: /}/ } );
|
|
235
|
+
const Comment = createToken( {
|
|
236
|
+
name: 'Comment',
|
|
237
|
+
pattern: /#.*/,
|
|
238
|
+
group: chevrotain.Lexer.SKIPPED
|
|
239
|
+
} );
|
|
240
|
+
|
|
241
|
+
// commas, blanks, tabs, newlines and carriage returns are whitespace characters wherever they appear outside of string fields
|
|
242
|
+
|
|
243
|
+
const WhiteSpace = createToken( {
|
|
244
|
+
name: 'WhiteSpace',
|
|
245
|
+
pattern: /[ ,\s]/,
|
|
246
|
+
group: chevrotain.Lexer.SKIPPED
|
|
247
|
+
} );
|
|
248
|
+
|
|
249
|
+
const tokens = [
|
|
250
|
+
WhiteSpace,
|
|
251
|
+
// keywords appear before the Identifier
|
|
252
|
+
NodeName,
|
|
253
|
+
DEF,
|
|
254
|
+
USE,
|
|
255
|
+
ROUTE,
|
|
256
|
+
TO,
|
|
257
|
+
TrueLiteral,
|
|
258
|
+
FalseLiteral,
|
|
259
|
+
NullLiteral,
|
|
260
|
+
// the Identifier must appear after the keywords because all keywords are valid identifiers
|
|
261
|
+
Version,
|
|
262
|
+
Identifier,
|
|
263
|
+
RouteIdentifier,
|
|
264
|
+
StringLiteral,
|
|
265
|
+
HexLiteral,
|
|
266
|
+
NumberLiteral,
|
|
267
|
+
LSquare,
|
|
268
|
+
RSquare,
|
|
269
|
+
LCurly,
|
|
270
|
+
RCurly,
|
|
271
|
+
Comment
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
const tokenVocabulary = {};
|
|
275
|
+
|
|
276
|
+
for ( let i = 0, l = tokens.length; i < l; i ++ ) {
|
|
277
|
+
|
|
278
|
+
const token = tokens[ i ];
|
|
279
|
+
|
|
280
|
+
tokenVocabulary[ token.name ] = token;
|
|
281
|
+
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return { tokens: tokens, tokenVocabulary: tokenVocabulary };
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
function createVisitor( BaseVRMLVisitor ) {
|
|
290
|
+
|
|
291
|
+
// the visitor is created dynamically based on the given base class
|
|
292
|
+
|
|
293
|
+
class VRMLToASTVisitor extends BaseVRMLVisitor {
|
|
294
|
+
|
|
295
|
+
constructor() {
|
|
296
|
+
|
|
297
|
+
super();
|
|
298
|
+
|
|
299
|
+
this.validateVisitor();
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
vrml( ctx ) {
|
|
304
|
+
|
|
305
|
+
const data = {
|
|
306
|
+
version: this.visit( ctx.version ),
|
|
307
|
+
nodes: [],
|
|
308
|
+
routes: []
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
for ( let i = 0, l = ctx.node.length; i < l; i ++ ) {
|
|
312
|
+
|
|
313
|
+
const node = ctx.node[ i ];
|
|
314
|
+
|
|
315
|
+
data.nodes.push( this.visit( node ) );
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if ( ctx.route ) {
|
|
320
|
+
|
|
321
|
+
for ( let i = 0, l = ctx.route.length; i < l; i ++ ) {
|
|
322
|
+
|
|
323
|
+
const route = ctx.route[ i ];
|
|
324
|
+
|
|
325
|
+
data.routes.push( this.visit( route ) );
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return data;
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
version( ctx ) {
|
|
336
|
+
|
|
337
|
+
return ctx.Version[ 0 ].image;
|
|
338
|
+
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
node( ctx ) {
|
|
342
|
+
|
|
343
|
+
const data = {
|
|
344
|
+
name: ctx.NodeName[ 0 ].image,
|
|
345
|
+
fields: []
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
if ( ctx.field ) {
|
|
349
|
+
|
|
350
|
+
for ( let i = 0, l = ctx.field.length; i < l; i ++ ) {
|
|
351
|
+
|
|
352
|
+
const field = ctx.field[ i ];
|
|
353
|
+
|
|
354
|
+
data.fields.push( this.visit( field ) );
|
|
355
|
+
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// DEF
|
|
361
|
+
|
|
362
|
+
if ( ctx.def ) {
|
|
363
|
+
|
|
364
|
+
data.DEF = this.visit( ctx.def[ 0 ] );
|
|
365
|
+
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return data;
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
field( ctx ) {
|
|
373
|
+
|
|
374
|
+
const data = {
|
|
375
|
+
name: ctx.Identifier[ 0 ].image,
|
|
376
|
+
type: null,
|
|
377
|
+
values: null
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
let result;
|
|
381
|
+
|
|
382
|
+
// SFValue
|
|
383
|
+
|
|
384
|
+
if ( ctx.singleFieldValue ) {
|
|
385
|
+
|
|
386
|
+
result = this.visit( ctx.singleFieldValue[ 0 ] );
|
|
387
|
+
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// MFValue
|
|
391
|
+
|
|
392
|
+
if ( ctx.multiFieldValue ) {
|
|
393
|
+
|
|
394
|
+
result = this.visit( ctx.multiFieldValue[ 0 ] );
|
|
395
|
+
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
data.type = result.type;
|
|
399
|
+
data.values = result.values;
|
|
400
|
+
|
|
401
|
+
return data;
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
def( ctx ) {
|
|
406
|
+
|
|
407
|
+
return ( ctx.Identifier || ctx.NodeName )[ 0 ].image;
|
|
408
|
+
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
use( ctx ) {
|
|
412
|
+
|
|
413
|
+
return { USE: ( ctx.Identifier || ctx.NodeName )[ 0 ].image };
|
|
414
|
+
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
singleFieldValue( ctx ) {
|
|
418
|
+
|
|
419
|
+
return processField( this, ctx );
|
|
420
|
+
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
multiFieldValue( ctx ) {
|
|
424
|
+
|
|
425
|
+
return processField( this, ctx );
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
route( ctx ) {
|
|
430
|
+
|
|
431
|
+
const data = {
|
|
432
|
+
FROM: ctx.RouteIdentifier[ 0 ].image,
|
|
433
|
+
TO: ctx.RouteIdentifier[ 1 ].image
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
return data;
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function processField( scope, ctx ) {
|
|
443
|
+
|
|
444
|
+
const field = {
|
|
445
|
+
type: null,
|
|
446
|
+
values: []
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
if ( ctx.node ) {
|
|
450
|
+
|
|
451
|
+
field.type = 'node';
|
|
452
|
+
|
|
453
|
+
for ( let i = 0, l = ctx.node.length; i < l; i ++ ) {
|
|
454
|
+
|
|
455
|
+
const node = ctx.node[ i ];
|
|
456
|
+
|
|
457
|
+
field.values.push( scope.visit( node ) );
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if ( ctx.use ) {
|
|
464
|
+
|
|
465
|
+
field.type = 'use';
|
|
466
|
+
|
|
467
|
+
for ( let i = 0, l = ctx.use.length; i < l; i ++ ) {
|
|
468
|
+
|
|
469
|
+
const use = ctx.use[ i ];
|
|
470
|
+
|
|
471
|
+
field.values.push( scope.visit( use ) );
|
|
472
|
+
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if ( ctx.StringLiteral ) {
|
|
478
|
+
|
|
479
|
+
field.type = 'string';
|
|
480
|
+
|
|
481
|
+
for ( let i = 0, l = ctx.StringLiteral.length; i < l; i ++ ) {
|
|
482
|
+
|
|
483
|
+
const stringLiteral = ctx.StringLiteral[ i ];
|
|
484
|
+
|
|
485
|
+
field.values.push( stringLiteral.image.replace( /'|"/g, '' ) );
|
|
486
|
+
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if ( ctx.NumberLiteral ) {
|
|
492
|
+
|
|
493
|
+
field.type = 'number';
|
|
494
|
+
|
|
495
|
+
for ( let i = 0, l = ctx.NumberLiteral.length; i < l; i ++ ) {
|
|
496
|
+
|
|
497
|
+
const numberLiteral = ctx.NumberLiteral[ i ];
|
|
498
|
+
|
|
499
|
+
field.values.push( parseFloat( numberLiteral.image ) );
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if ( ctx.HexLiteral ) {
|
|
506
|
+
|
|
507
|
+
field.type = 'hex';
|
|
508
|
+
|
|
509
|
+
for ( let i = 0, l = ctx.HexLiteral.length; i < l; i ++ ) {
|
|
510
|
+
|
|
511
|
+
const hexLiteral = ctx.HexLiteral[ i ];
|
|
512
|
+
|
|
513
|
+
field.values.push( hexLiteral.image );
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
if ( ctx.TrueLiteral ) {
|
|
520
|
+
|
|
521
|
+
field.type = 'boolean';
|
|
522
|
+
|
|
523
|
+
for ( let i = 0, l = ctx.TrueLiteral.length; i < l; i ++ ) {
|
|
524
|
+
|
|
525
|
+
const trueLiteral = ctx.TrueLiteral[ i ];
|
|
526
|
+
|
|
527
|
+
if ( trueLiteral.image === 'TRUE' ) field.values.push( true );
|
|
528
|
+
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if ( ctx.FalseLiteral ) {
|
|
534
|
+
|
|
535
|
+
field.type = 'boolean';
|
|
536
|
+
|
|
537
|
+
for ( let i = 0, l = ctx.FalseLiteral.length; i < l; i ++ ) {
|
|
538
|
+
|
|
539
|
+
const falseLiteral = ctx.FalseLiteral[ i ];
|
|
540
|
+
|
|
541
|
+
if ( falseLiteral.image === 'FALSE' ) field.values.push( false );
|
|
542
|
+
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if ( ctx.NullLiteral ) {
|
|
548
|
+
|
|
549
|
+
field.type = 'null';
|
|
550
|
+
|
|
551
|
+
ctx.NullLiteral.forEach( function () {
|
|
552
|
+
|
|
553
|
+
field.values.push( null );
|
|
554
|
+
|
|
555
|
+
} );
|
|
556
|
+
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return field;
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return new VRMLToASTVisitor();
|
|
564
|
+
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function parseTree( tree ) {
|
|
568
|
+
|
|
569
|
+
// console.log( JSON.stringify( tree, null, 2 ) );
|
|
570
|
+
|
|
571
|
+
const nodes = tree.nodes;
|
|
572
|
+
const scene = new Scene();
|
|
573
|
+
|
|
574
|
+
// first iteration: build nodemap based on DEF statements
|
|
575
|
+
|
|
576
|
+
for ( let i = 0, l = nodes.length; i < l; i ++ ) {
|
|
577
|
+
|
|
578
|
+
const node = nodes[ i ];
|
|
579
|
+
|
|
580
|
+
buildNodeMap( node );
|
|
581
|
+
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// second iteration: build nodes
|
|
585
|
+
|
|
586
|
+
for ( let i = 0, l = nodes.length; i < l; i ++ ) {
|
|
587
|
+
|
|
588
|
+
const node = nodes[ i ];
|
|
589
|
+
const object = getNode( node );
|
|
590
|
+
|
|
591
|
+
if ( object instanceof Object3D ) scene.add( object );
|
|
592
|
+
|
|
593
|
+
if ( node.name === 'WorldInfo' ) scene.userData.worldInfo = object;
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return scene;
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function buildNodeMap( node ) {
|
|
602
|
+
|
|
603
|
+
if ( node.DEF ) {
|
|
604
|
+
|
|
605
|
+
nodeMap[ node.DEF ] = node;
|
|
606
|
+
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const fields = node.fields;
|
|
610
|
+
|
|
611
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
612
|
+
|
|
613
|
+
const field = fields[ i ];
|
|
614
|
+
|
|
615
|
+
if ( field.type === 'node' ) {
|
|
616
|
+
|
|
617
|
+
const fieldValues = field.values;
|
|
618
|
+
|
|
619
|
+
for ( let j = 0, jl = fieldValues.length; j < jl; j ++ ) {
|
|
620
|
+
|
|
621
|
+
buildNodeMap( fieldValues[ j ] );
|
|
622
|
+
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
function getNode( node ) {
|
|
634
|
+
|
|
635
|
+
// handle case where a node refers to a different one
|
|
636
|
+
|
|
637
|
+
if ( node.USE ) {
|
|
638
|
+
|
|
639
|
+
return resolveUSE( node.USE );
|
|
640
|
+
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
if ( node.build !== undefined ) return node.build;
|
|
644
|
+
|
|
645
|
+
node.build = buildNode( node );
|
|
646
|
+
|
|
647
|
+
return node.build;
|
|
648
|
+
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// node builder
|
|
652
|
+
|
|
653
|
+
function buildNode( node ) {
|
|
654
|
+
|
|
655
|
+
const nodeName = node.name;
|
|
656
|
+
let build;
|
|
657
|
+
|
|
658
|
+
switch ( nodeName ) {
|
|
659
|
+
|
|
660
|
+
case 'Anchor':
|
|
661
|
+
case 'Group':
|
|
662
|
+
case 'Transform':
|
|
663
|
+
case 'Collision':
|
|
664
|
+
build = buildGroupingNode( node );
|
|
665
|
+
break;
|
|
666
|
+
|
|
667
|
+
case 'Background':
|
|
668
|
+
build = buildBackgroundNode( node );
|
|
669
|
+
break;
|
|
670
|
+
|
|
671
|
+
case 'Shape':
|
|
672
|
+
build = buildShapeNode( node );
|
|
673
|
+
break;
|
|
674
|
+
|
|
675
|
+
case 'Appearance':
|
|
676
|
+
build = buildAppearanceNode( node );
|
|
677
|
+
break;
|
|
678
|
+
|
|
679
|
+
case 'Material':
|
|
680
|
+
build = buildMaterialNode( node );
|
|
681
|
+
break;
|
|
682
|
+
|
|
683
|
+
case 'ImageTexture':
|
|
684
|
+
build = buildImageTextureNode( node );
|
|
685
|
+
break;
|
|
686
|
+
|
|
687
|
+
case 'PixelTexture':
|
|
688
|
+
build = buildPixelTextureNode( node );
|
|
689
|
+
break;
|
|
690
|
+
|
|
691
|
+
case 'TextureTransform':
|
|
692
|
+
build = buildTextureTransformNode( node );
|
|
693
|
+
break;
|
|
694
|
+
|
|
695
|
+
case 'IndexedFaceSet':
|
|
696
|
+
build = buildIndexedFaceSetNode( node );
|
|
697
|
+
break;
|
|
698
|
+
|
|
699
|
+
case 'IndexedLineSet':
|
|
700
|
+
build = buildIndexedLineSetNode( node );
|
|
701
|
+
break;
|
|
702
|
+
|
|
703
|
+
case 'PointSet':
|
|
704
|
+
build = buildPointSetNode( node );
|
|
705
|
+
break;
|
|
706
|
+
|
|
707
|
+
case 'Box':
|
|
708
|
+
build = buildBoxNode( node );
|
|
709
|
+
break;
|
|
710
|
+
|
|
711
|
+
case 'Cone':
|
|
712
|
+
build = buildConeNode( node );
|
|
713
|
+
break;
|
|
714
|
+
|
|
715
|
+
case 'Cylinder':
|
|
716
|
+
build = buildCylinderNode( node );
|
|
717
|
+
break;
|
|
718
|
+
|
|
719
|
+
case 'Sphere':
|
|
720
|
+
build = buildSphereNode( node );
|
|
721
|
+
break;
|
|
722
|
+
|
|
723
|
+
case 'ElevationGrid':
|
|
724
|
+
build = buildElevationGridNode( node );
|
|
725
|
+
break;
|
|
726
|
+
|
|
727
|
+
case 'Extrusion':
|
|
728
|
+
build = buildExtrusionNode( node );
|
|
729
|
+
break;
|
|
730
|
+
|
|
731
|
+
case 'Color':
|
|
732
|
+
case 'Coordinate':
|
|
733
|
+
case 'Normal':
|
|
734
|
+
case 'TextureCoordinate':
|
|
735
|
+
build = buildGeometricNode( node );
|
|
736
|
+
break;
|
|
737
|
+
|
|
738
|
+
case 'WorldInfo':
|
|
739
|
+
build = buildWorldInfoNode( node );
|
|
740
|
+
break;
|
|
741
|
+
|
|
742
|
+
case 'OrthographicCamera':
|
|
743
|
+
case 'PerspectiveCamera':
|
|
744
|
+
build = buildCamera( node, nodeName );
|
|
745
|
+
break;
|
|
746
|
+
|
|
747
|
+
case 'Billboard':
|
|
748
|
+
|
|
749
|
+
case 'Inline':
|
|
750
|
+
case 'LOD':
|
|
751
|
+
case 'Switch':
|
|
752
|
+
|
|
753
|
+
case 'AudioClip':
|
|
754
|
+
case 'DirectionalLight':
|
|
755
|
+
case 'PointLight':
|
|
756
|
+
case 'Script':
|
|
757
|
+
case 'Sound':
|
|
758
|
+
case 'SpotLight':
|
|
759
|
+
|
|
760
|
+
case 'CylinderSensor':
|
|
761
|
+
case 'PlaneSensor':
|
|
762
|
+
case 'ProximitySensor':
|
|
763
|
+
case 'SphereSensor':
|
|
764
|
+
case 'TimeSensor':
|
|
765
|
+
case 'TouchSensor':
|
|
766
|
+
case 'VisibilitySensor':
|
|
767
|
+
|
|
768
|
+
case 'Text':
|
|
769
|
+
|
|
770
|
+
case 'FontStyle':
|
|
771
|
+
case 'MovieTexture':
|
|
772
|
+
|
|
773
|
+
case 'ColorInterpolator':
|
|
774
|
+
case 'CoordinateInterpolator':
|
|
775
|
+
case 'NormalInterpolator':
|
|
776
|
+
case 'OrientationInterpolator':
|
|
777
|
+
case 'PositionInterpolator':
|
|
778
|
+
case 'ScalarInterpolator':
|
|
779
|
+
|
|
780
|
+
case 'Fog':
|
|
781
|
+
case 'NavigationInfo':
|
|
782
|
+
case 'Viewpoint':
|
|
783
|
+
// node not supported yet
|
|
784
|
+
break;
|
|
785
|
+
|
|
786
|
+
default:
|
|
787
|
+
console.warn( 'THREE.VRMLLoader: Unknown node:', nodeName );
|
|
788
|
+
break;
|
|
789
|
+
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if ( build !== undefined && node.DEF !== undefined && build.hasOwnProperty( 'name' ) === true ) {
|
|
793
|
+
|
|
794
|
+
build.name = node.DEF;
|
|
795
|
+
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
return build;
|
|
799
|
+
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
function buildGroupingNode( node ) {
|
|
803
|
+
|
|
804
|
+
const object = new Group();
|
|
805
|
+
|
|
806
|
+
//
|
|
807
|
+
|
|
808
|
+
const fields = node.fields;
|
|
809
|
+
|
|
810
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
811
|
+
|
|
812
|
+
const field = fields[ i ];
|
|
813
|
+
const fieldName = field.name;
|
|
814
|
+
const fieldValues = field.values;
|
|
815
|
+
|
|
816
|
+
switch ( fieldName ) {
|
|
817
|
+
|
|
818
|
+
case 'bboxCenter':
|
|
819
|
+
// field not supported
|
|
820
|
+
break;
|
|
821
|
+
|
|
822
|
+
case 'bboxSize':
|
|
823
|
+
// field not supported
|
|
824
|
+
break;
|
|
825
|
+
|
|
826
|
+
case 'center':
|
|
827
|
+
// field not supported
|
|
828
|
+
break;
|
|
829
|
+
|
|
830
|
+
case 'children':
|
|
831
|
+
parseFieldChildren( fieldValues, object );
|
|
832
|
+
break;
|
|
833
|
+
|
|
834
|
+
case 'description':
|
|
835
|
+
// field not supported
|
|
836
|
+
break;
|
|
837
|
+
|
|
838
|
+
case 'collide':
|
|
839
|
+
// field not supported
|
|
840
|
+
break;
|
|
841
|
+
|
|
842
|
+
case 'parameter':
|
|
843
|
+
// field not supported
|
|
844
|
+
break;
|
|
845
|
+
|
|
846
|
+
case 'rotation':
|
|
847
|
+
const axis = new Vector3( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] ).normalize();
|
|
848
|
+
const angle = fieldValues[ 3 ];
|
|
849
|
+
object.quaternion.setFromAxisAngle( axis, angle );
|
|
850
|
+
break;
|
|
851
|
+
|
|
852
|
+
case 'scale':
|
|
853
|
+
object.scale.set( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
854
|
+
break;
|
|
855
|
+
|
|
856
|
+
case 'scaleOrientation':
|
|
857
|
+
// field not supported
|
|
858
|
+
break;
|
|
859
|
+
|
|
860
|
+
case 'translation':
|
|
861
|
+
object.position.set( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] );
|
|
862
|
+
break;
|
|
863
|
+
|
|
864
|
+
case 'proxy':
|
|
865
|
+
// field not supported
|
|
866
|
+
break;
|
|
867
|
+
|
|
868
|
+
case 'url':
|
|
869
|
+
// field not supported
|
|
870
|
+
break;
|
|
871
|
+
|
|
872
|
+
default:
|
|
873
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
874
|
+
break;
|
|
875
|
+
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
return object;
|
|
881
|
+
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function buildBackgroundNode( node ) {
|
|
885
|
+
|
|
886
|
+
const group = new Group();
|
|
887
|
+
|
|
888
|
+
let groundAngle, groundColor;
|
|
889
|
+
let skyAngle, skyColor;
|
|
890
|
+
|
|
891
|
+
const fields = node.fields;
|
|
892
|
+
|
|
893
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
894
|
+
|
|
895
|
+
const field = fields[ i ];
|
|
896
|
+
const fieldName = field.name;
|
|
897
|
+
const fieldValues = field.values;
|
|
898
|
+
|
|
899
|
+
switch ( fieldName ) {
|
|
900
|
+
|
|
901
|
+
case 'groundAngle':
|
|
902
|
+
groundAngle = fieldValues;
|
|
903
|
+
break;
|
|
904
|
+
|
|
905
|
+
case 'groundColor':
|
|
906
|
+
groundColor = fieldValues;
|
|
907
|
+
break;
|
|
908
|
+
|
|
909
|
+
case 'backUrl':
|
|
910
|
+
// field not supported
|
|
911
|
+
break;
|
|
912
|
+
|
|
913
|
+
case 'bottomUrl':
|
|
914
|
+
// field not supported
|
|
915
|
+
break;
|
|
916
|
+
|
|
917
|
+
case 'frontUrl':
|
|
918
|
+
// field not supported
|
|
919
|
+
break;
|
|
920
|
+
|
|
921
|
+
case 'leftUrl':
|
|
922
|
+
// field not supported
|
|
923
|
+
break;
|
|
924
|
+
|
|
925
|
+
case 'rightUrl':
|
|
926
|
+
// field not supported
|
|
927
|
+
break;
|
|
928
|
+
|
|
929
|
+
case 'topUrl':
|
|
930
|
+
// field not supported
|
|
931
|
+
break;
|
|
932
|
+
|
|
933
|
+
case 'skyAngle':
|
|
934
|
+
skyAngle = fieldValues;
|
|
935
|
+
break;
|
|
936
|
+
|
|
937
|
+
case 'skyColor':
|
|
938
|
+
skyColor = fieldValues;
|
|
939
|
+
break;
|
|
940
|
+
|
|
941
|
+
default:
|
|
942
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
943
|
+
break;
|
|
944
|
+
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
const radius = 10000;
|
|
950
|
+
|
|
951
|
+
// sky
|
|
952
|
+
|
|
953
|
+
if ( skyColor ) {
|
|
954
|
+
|
|
955
|
+
const skyGeometry = new SphereGeometry( radius, 32, 16 );
|
|
956
|
+
const skyMaterial = new MeshBasicMaterial( { fog: false, side: BackSide, depthWrite: false, depthTest: false } );
|
|
957
|
+
|
|
958
|
+
if ( skyColor.length > 3 ) {
|
|
959
|
+
|
|
960
|
+
paintFaces( skyGeometry, radius, skyAngle, toColorArray( skyColor ), true );
|
|
961
|
+
skyMaterial.vertexColors = true;
|
|
962
|
+
|
|
963
|
+
} else {
|
|
964
|
+
|
|
965
|
+
skyMaterial.color.setRGB( skyColor[ 0 ], skyColor[ 1 ], skyColor[ 2 ], SRGBColorSpace );
|
|
966
|
+
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
const sky = new Mesh( skyGeometry, skyMaterial );
|
|
970
|
+
group.add( sky );
|
|
971
|
+
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// ground
|
|
975
|
+
|
|
976
|
+
if ( groundColor ) {
|
|
977
|
+
|
|
978
|
+
if ( groundColor.length > 0 ) {
|
|
979
|
+
|
|
980
|
+
const groundGeometry = new SphereGeometry( radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
|
|
981
|
+
const groundMaterial = new MeshBasicMaterial( { fog: false, side: BackSide, vertexColors: true, depthWrite: false, depthTest: false } );
|
|
982
|
+
|
|
983
|
+
paintFaces( groundGeometry, radius, groundAngle, toColorArray( groundColor ), false );
|
|
984
|
+
|
|
985
|
+
const ground = new Mesh( groundGeometry, groundMaterial );
|
|
986
|
+
group.add( ground );
|
|
987
|
+
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// render background group first
|
|
993
|
+
|
|
994
|
+
group.renderOrder = - Infinity;
|
|
995
|
+
|
|
996
|
+
return group;
|
|
997
|
+
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function buildShapeNode( node ) {
|
|
1001
|
+
|
|
1002
|
+
const fields = node.fields;
|
|
1003
|
+
|
|
1004
|
+
// if the appearance field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
1005
|
+
|
|
1006
|
+
let material = new MeshBasicMaterial( {
|
|
1007
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1008
|
+
color: 0x000000
|
|
1009
|
+
} );
|
|
1010
|
+
let geometry;
|
|
1011
|
+
|
|
1012
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1013
|
+
|
|
1014
|
+
const field = fields[ i ];
|
|
1015
|
+
const fieldName = field.name;
|
|
1016
|
+
const fieldValues = field.values;
|
|
1017
|
+
|
|
1018
|
+
switch ( fieldName ) {
|
|
1019
|
+
|
|
1020
|
+
case 'appearance':
|
|
1021
|
+
if ( fieldValues[ 0 ] !== null ) {
|
|
1022
|
+
|
|
1023
|
+
material = getNode( fieldValues[ 0 ] );
|
|
1024
|
+
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
break;
|
|
1028
|
+
|
|
1029
|
+
case 'geometry':
|
|
1030
|
+
if ( fieldValues[ 0 ] !== null ) {
|
|
1031
|
+
|
|
1032
|
+
geometry = getNode( fieldValues[ 0 ] );
|
|
1033
|
+
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
break;
|
|
1037
|
+
|
|
1038
|
+
default:
|
|
1039
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1040
|
+
break;
|
|
1041
|
+
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// build 3D object
|
|
1047
|
+
|
|
1048
|
+
let object;
|
|
1049
|
+
|
|
1050
|
+
if ( geometry && geometry.attributes.position ) {
|
|
1051
|
+
|
|
1052
|
+
const type = geometry._type;
|
|
1053
|
+
|
|
1054
|
+
if ( type === 'points' ) { // points
|
|
1055
|
+
|
|
1056
|
+
const pointsMaterial = new PointsMaterial( {
|
|
1057
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1058
|
+
color: 0xffffff,
|
|
1059
|
+
opacity: material.opacity,
|
|
1060
|
+
transparent: material.transparent
|
|
1061
|
+
} );
|
|
1062
|
+
|
|
1063
|
+
if ( geometry.attributes.color !== undefined ) {
|
|
1064
|
+
|
|
1065
|
+
pointsMaterial.vertexColors = true;
|
|
1066
|
+
|
|
1067
|
+
} else {
|
|
1068
|
+
|
|
1069
|
+
// if the color field is NULL and there is a material defined for the appearance affecting this PointSet, then use the emissiveColor of the material to draw the points
|
|
1070
|
+
|
|
1071
|
+
if ( material.isMeshPhongMaterial ) {
|
|
1072
|
+
|
|
1073
|
+
pointsMaterial.color.copy( material.emissive );
|
|
1074
|
+
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
object = new Points( geometry, pointsMaterial );
|
|
1080
|
+
|
|
1081
|
+
} else if ( type === 'line' ) { // lines
|
|
1082
|
+
|
|
1083
|
+
const lineMaterial = new LineBasicMaterial( {
|
|
1084
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1085
|
+
color: 0xffffff,
|
|
1086
|
+
opacity: material.opacity,
|
|
1087
|
+
transparent: material.transparent
|
|
1088
|
+
} );
|
|
1089
|
+
|
|
1090
|
+
if ( geometry.attributes.color !== undefined ) {
|
|
1091
|
+
|
|
1092
|
+
lineMaterial.vertexColors = true;
|
|
1093
|
+
|
|
1094
|
+
} else {
|
|
1095
|
+
|
|
1096
|
+
// if the color field is NULL and there is a material defined for the appearance affecting this IndexedLineSet, then use the emissiveColor of the material to draw the lines
|
|
1097
|
+
|
|
1098
|
+
if ( material.isMeshPhongMaterial ) {
|
|
1099
|
+
|
|
1100
|
+
lineMaterial.color.copy( material.emissive );
|
|
1101
|
+
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
object = new LineSegments( geometry, lineMaterial );
|
|
1107
|
+
|
|
1108
|
+
} else { // consider meshes
|
|
1109
|
+
|
|
1110
|
+
// check "solid" hint (it's placed in the geometry but affects the material)
|
|
1111
|
+
|
|
1112
|
+
if ( geometry._solid !== undefined ) {
|
|
1113
|
+
|
|
1114
|
+
material.side = ( geometry._solid ) ? FrontSide : DoubleSide;
|
|
1115
|
+
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// check for vertex colors
|
|
1119
|
+
|
|
1120
|
+
if ( geometry.attributes.color !== undefined ) {
|
|
1121
|
+
|
|
1122
|
+
material.vertexColors = true;
|
|
1123
|
+
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
object = new Mesh( geometry, material );
|
|
1127
|
+
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
} else {
|
|
1131
|
+
|
|
1132
|
+
object = new Object3D();
|
|
1133
|
+
|
|
1134
|
+
// if the geometry field is NULL or no vertices are defined the object is not drawn
|
|
1135
|
+
|
|
1136
|
+
object.visible = false;
|
|
1137
|
+
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
return object;
|
|
1141
|
+
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
function buildAppearanceNode( node ) {
|
|
1145
|
+
|
|
1146
|
+
let material = new MeshPhongMaterial();
|
|
1147
|
+
let transformData;
|
|
1148
|
+
|
|
1149
|
+
const fields = node.fields;
|
|
1150
|
+
|
|
1151
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1152
|
+
|
|
1153
|
+
const field = fields[ i ];
|
|
1154
|
+
const fieldName = field.name;
|
|
1155
|
+
const fieldValues = field.values;
|
|
1156
|
+
|
|
1157
|
+
switch ( fieldName ) {
|
|
1158
|
+
|
|
1159
|
+
case 'material':
|
|
1160
|
+
if ( fieldValues[ 0 ] !== null ) {
|
|
1161
|
+
|
|
1162
|
+
const materialData = getNode( fieldValues[ 0 ] );
|
|
1163
|
+
|
|
1164
|
+
if ( materialData.diffuseColor ) material.color.copy( materialData.diffuseColor );
|
|
1165
|
+
if ( materialData.emissiveColor ) material.emissive.copy( materialData.emissiveColor );
|
|
1166
|
+
if ( materialData.shininess ) material.shininess = materialData.shininess;
|
|
1167
|
+
if ( materialData.specularColor ) material.specular.copy( materialData.specularColor );
|
|
1168
|
+
if ( materialData.transparency ) material.opacity = 1 - materialData.transparency;
|
|
1169
|
+
if ( materialData.transparency > 0 ) material.transparent = true;
|
|
1170
|
+
|
|
1171
|
+
} else {
|
|
1172
|
+
|
|
1173
|
+
// if the material field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
|
|
1174
|
+
|
|
1175
|
+
material = new MeshBasicMaterial( {
|
|
1176
|
+
name: Loader.DEFAULT_MATERIAL_NAME,
|
|
1177
|
+
color: 0x000000
|
|
1178
|
+
} );
|
|
1179
|
+
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
break;
|
|
1183
|
+
|
|
1184
|
+
case 'texture':
|
|
1185
|
+
const textureNode = fieldValues[ 0 ];
|
|
1186
|
+
if ( textureNode !== null ) {
|
|
1187
|
+
|
|
1188
|
+
if ( textureNode.name === 'ImageTexture' || textureNode.name === 'PixelTexture' ) {
|
|
1189
|
+
|
|
1190
|
+
material.map = getNode( textureNode );
|
|
1191
|
+
|
|
1192
|
+
} else {
|
|
1193
|
+
|
|
1194
|
+
// MovieTexture not supported yet
|
|
1195
|
+
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
break;
|
|
1201
|
+
|
|
1202
|
+
case 'textureTransform':
|
|
1203
|
+
if ( fieldValues[ 0 ] !== null ) {
|
|
1204
|
+
|
|
1205
|
+
transformData = getNode( fieldValues[ 0 ] );
|
|
1206
|
+
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
break;
|
|
1210
|
+
|
|
1211
|
+
default:
|
|
1212
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1213
|
+
break;
|
|
1214
|
+
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
// only apply texture transform data if a texture was defined
|
|
1220
|
+
|
|
1221
|
+
if ( material.map ) {
|
|
1222
|
+
|
|
1223
|
+
// respect VRML lighting model
|
|
1224
|
+
|
|
1225
|
+
if ( material.map.__type ) {
|
|
1226
|
+
|
|
1227
|
+
switch ( material.map.__type ) {
|
|
1228
|
+
|
|
1229
|
+
case TEXTURE_TYPE.INTENSITY_ALPHA:
|
|
1230
|
+
material.opacity = 1; // ignore transparency
|
|
1231
|
+
break;
|
|
1232
|
+
|
|
1233
|
+
case TEXTURE_TYPE.RGB:
|
|
1234
|
+
material.color.set( 0xffffff ); // ignore material color
|
|
1235
|
+
break;
|
|
1236
|
+
|
|
1237
|
+
case TEXTURE_TYPE.RGBA:
|
|
1238
|
+
material.color.set( 0xffffff ); // ignore material color
|
|
1239
|
+
material.opacity = 1; // ignore transparency
|
|
1240
|
+
break;
|
|
1241
|
+
|
|
1242
|
+
default:
|
|
1243
|
+
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
delete material.map.__type;
|
|
1247
|
+
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
// apply texture transform
|
|
1251
|
+
|
|
1252
|
+
if ( transformData ) {
|
|
1253
|
+
|
|
1254
|
+
material.map.center.copy( transformData.center );
|
|
1255
|
+
material.map.rotation = transformData.rotation;
|
|
1256
|
+
material.map.repeat.copy( transformData.scale );
|
|
1257
|
+
material.map.offset.copy( transformData.translation );
|
|
1258
|
+
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
return material;
|
|
1264
|
+
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
function buildMaterialNode( node ) {
|
|
1268
|
+
|
|
1269
|
+
const materialData = {};
|
|
1270
|
+
|
|
1271
|
+
const fields = node.fields;
|
|
1272
|
+
|
|
1273
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1274
|
+
|
|
1275
|
+
const field = fields[ i ];
|
|
1276
|
+
const fieldName = field.name;
|
|
1277
|
+
const fieldValues = field.values;
|
|
1278
|
+
|
|
1279
|
+
switch ( fieldName ) {
|
|
1280
|
+
|
|
1281
|
+
case 'ambientIntensity':
|
|
1282
|
+
// field not supported
|
|
1283
|
+
break;
|
|
1284
|
+
|
|
1285
|
+
case 'diffuseColor':
|
|
1286
|
+
materialData.diffuseColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1287
|
+
break;
|
|
1288
|
+
|
|
1289
|
+
case 'emissiveColor':
|
|
1290
|
+
materialData.emissiveColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1291
|
+
break;
|
|
1292
|
+
|
|
1293
|
+
case 'shininess':
|
|
1294
|
+
materialData.shininess = fieldValues[ 0 ];
|
|
1295
|
+
break;
|
|
1296
|
+
|
|
1297
|
+
case 'specularColor':
|
|
1298
|
+
materialData.specularColor = new Color().setRGB( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ], SRGBColorSpace );
|
|
1299
|
+
break;
|
|
1300
|
+
|
|
1301
|
+
case 'transparency':
|
|
1302
|
+
materialData.transparency = fieldValues[ 0 ];
|
|
1303
|
+
break;
|
|
1304
|
+
|
|
1305
|
+
default:
|
|
1306
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1307
|
+
break;
|
|
1308
|
+
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
return materialData;
|
|
1314
|
+
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
function parseHexColor( hex, textureType, color ) {
|
|
1318
|
+
|
|
1319
|
+
let value;
|
|
1320
|
+
|
|
1321
|
+
switch ( textureType ) {
|
|
1322
|
+
|
|
1323
|
+
case TEXTURE_TYPE.INTENSITY:
|
|
1324
|
+
// Intensity texture: A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image
|
|
1325
|
+
value = parseInt( hex );
|
|
1326
|
+
color.r = value;
|
|
1327
|
+
color.g = value;
|
|
1328
|
+
color.b = value;
|
|
1329
|
+
color.a = 1;
|
|
1330
|
+
break;
|
|
1331
|
+
|
|
1332
|
+
case TEXTURE_TYPE.INTENSITY_ALPHA:
|
|
1333
|
+
// Intensity+Alpha texture: A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte.
|
|
1334
|
+
value = parseInt( '0x' + hex.substring( 2, 4 ) );
|
|
1335
|
+
color.r = value;
|
|
1336
|
+
color.g = value;
|
|
1337
|
+
color.b = value;
|
|
1338
|
+
color.a = parseInt( '0x' + hex.substring( 4, 6 ) );
|
|
1339
|
+
break;
|
|
1340
|
+
|
|
1341
|
+
case TEXTURE_TYPE.RGB:
|
|
1342
|
+
// RGB texture: Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components
|
|
1343
|
+
color.r = parseInt( '0x' + hex.substring( 2, 4 ) );
|
|
1344
|
+
color.g = parseInt( '0x' + hex.substring( 4, 6 ) );
|
|
1345
|
+
color.b = parseInt( '0x' + hex.substring( 6, 8 ) );
|
|
1346
|
+
color.a = 1;
|
|
1347
|
+
break;
|
|
1348
|
+
|
|
1349
|
+
case TEXTURE_TYPE.RGBA:
|
|
1350
|
+
// RGBA texture: Four-component images specify the alpha opacity byte after red/green/blue
|
|
1351
|
+
color.r = parseInt( '0x' + hex.substring( 2, 4 ) );
|
|
1352
|
+
color.g = parseInt( '0x' + hex.substring( 4, 6 ) );
|
|
1353
|
+
color.b = parseInt( '0x' + hex.substring( 6, 8 ) );
|
|
1354
|
+
color.a = parseInt( '0x' + hex.substring( 8, 10 ) );
|
|
1355
|
+
break;
|
|
1356
|
+
|
|
1357
|
+
default:
|
|
1358
|
+
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
function getTextureType( num_components ) {
|
|
1364
|
+
|
|
1365
|
+
let type;
|
|
1366
|
+
|
|
1367
|
+
switch ( num_components ) {
|
|
1368
|
+
|
|
1369
|
+
case 1:
|
|
1370
|
+
type = TEXTURE_TYPE.INTENSITY;
|
|
1371
|
+
break;
|
|
1372
|
+
|
|
1373
|
+
case 2:
|
|
1374
|
+
type = TEXTURE_TYPE.INTENSITY_ALPHA;
|
|
1375
|
+
break;
|
|
1376
|
+
|
|
1377
|
+
case 3:
|
|
1378
|
+
type = TEXTURE_TYPE.RGB;
|
|
1379
|
+
break;
|
|
1380
|
+
|
|
1381
|
+
case 4:
|
|
1382
|
+
type = TEXTURE_TYPE.RGBA;
|
|
1383
|
+
break;
|
|
1384
|
+
|
|
1385
|
+
default:
|
|
1386
|
+
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
return type;
|
|
1390
|
+
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
function buildPixelTextureNode( node ) {
|
|
1394
|
+
|
|
1395
|
+
let texture;
|
|
1396
|
+
let wrapS = RepeatWrapping;
|
|
1397
|
+
let wrapT = RepeatWrapping;
|
|
1398
|
+
|
|
1399
|
+
const fields = node.fields;
|
|
1400
|
+
|
|
1401
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1402
|
+
|
|
1403
|
+
const field = fields[ i ];
|
|
1404
|
+
const fieldName = field.name;
|
|
1405
|
+
const fieldValues = field.values;
|
|
1406
|
+
|
|
1407
|
+
switch ( fieldName ) {
|
|
1408
|
+
|
|
1409
|
+
case 'image':
|
|
1410
|
+
const width = fieldValues[ 0 ];
|
|
1411
|
+
const height = fieldValues[ 1 ];
|
|
1412
|
+
const num_components = fieldValues[ 2 ];
|
|
1413
|
+
|
|
1414
|
+
const textureType = getTextureType( num_components );
|
|
1415
|
+
|
|
1416
|
+
const data = new Uint8Array( 4 * width * height );
|
|
1417
|
+
|
|
1418
|
+
const color = { r: 0, g: 0, b: 0, a: 0 };
|
|
1419
|
+
|
|
1420
|
+
for ( let j = 3, k = 0, jl = fieldValues.length; j < jl; j ++, k ++ ) {
|
|
1421
|
+
|
|
1422
|
+
parseHexColor( fieldValues[ j ], textureType, color );
|
|
1423
|
+
|
|
1424
|
+
const stride = k * 4;
|
|
1425
|
+
|
|
1426
|
+
data[ stride + 0 ] = color.r;
|
|
1427
|
+
data[ stride + 1 ] = color.g;
|
|
1428
|
+
data[ stride + 2 ] = color.b;
|
|
1429
|
+
data[ stride + 3 ] = color.a;
|
|
1430
|
+
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
texture = new DataTexture( data, width, height );
|
|
1434
|
+
texture.colorSpace = SRGBColorSpace;
|
|
1435
|
+
texture.needsUpdate = true;
|
|
1436
|
+
texture.__type = textureType; // needed for material modifications
|
|
1437
|
+
break;
|
|
1438
|
+
|
|
1439
|
+
case 'repeatS':
|
|
1440
|
+
if ( fieldValues[ 0 ] === false ) wrapS = ClampToEdgeWrapping;
|
|
1441
|
+
break;
|
|
1442
|
+
|
|
1443
|
+
case 'repeatT':
|
|
1444
|
+
if ( fieldValues[ 0 ] === false ) wrapT = ClampToEdgeWrapping;
|
|
1445
|
+
break;
|
|
1446
|
+
|
|
1447
|
+
default:
|
|
1448
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1449
|
+
break;
|
|
1450
|
+
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if ( texture ) {
|
|
1456
|
+
|
|
1457
|
+
texture.wrapS = wrapS;
|
|
1458
|
+
texture.wrapT = wrapT;
|
|
1459
|
+
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
return texture;
|
|
1463
|
+
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
function buildImageTextureNode( node ) {
|
|
1467
|
+
|
|
1468
|
+
let texture;
|
|
1469
|
+
let wrapS = RepeatWrapping;
|
|
1470
|
+
let wrapT = RepeatWrapping;
|
|
1471
|
+
|
|
1472
|
+
const fields = node.fields;
|
|
1473
|
+
|
|
1474
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1475
|
+
|
|
1476
|
+
const field = fields[ i ];
|
|
1477
|
+
const fieldName = field.name;
|
|
1478
|
+
const fieldValues = field.values;
|
|
1479
|
+
|
|
1480
|
+
switch ( fieldName ) {
|
|
1481
|
+
|
|
1482
|
+
case 'url':
|
|
1483
|
+
const url = fieldValues[ 0 ];
|
|
1484
|
+
if ( url ) texture = textureLoader.load( url );
|
|
1485
|
+
break;
|
|
1486
|
+
|
|
1487
|
+
case 'repeatS':
|
|
1488
|
+
if ( fieldValues[ 0 ] === false ) wrapS = ClampToEdgeWrapping;
|
|
1489
|
+
break;
|
|
1490
|
+
|
|
1491
|
+
case 'repeatT':
|
|
1492
|
+
if ( fieldValues[ 0 ] === false ) wrapT = ClampToEdgeWrapping;
|
|
1493
|
+
break;
|
|
1494
|
+
|
|
1495
|
+
default:
|
|
1496
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1497
|
+
break;
|
|
1498
|
+
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
if ( texture ) {
|
|
1504
|
+
|
|
1505
|
+
texture.wrapS = wrapS;
|
|
1506
|
+
texture.wrapT = wrapT;
|
|
1507
|
+
texture.colorSpace = SRGBColorSpace;
|
|
1508
|
+
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
return texture;
|
|
1512
|
+
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
function buildTextureTransformNode( node ) {
|
|
1516
|
+
|
|
1517
|
+
const transformData = {
|
|
1518
|
+
center: new Vector2(),
|
|
1519
|
+
rotation: new Vector2(),
|
|
1520
|
+
scale: new Vector2(),
|
|
1521
|
+
translation: new Vector2()
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
const fields = node.fields;
|
|
1525
|
+
|
|
1526
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1527
|
+
|
|
1528
|
+
const field = fields[ i ];
|
|
1529
|
+
const fieldName = field.name;
|
|
1530
|
+
const fieldValues = field.values;
|
|
1531
|
+
|
|
1532
|
+
switch ( fieldName ) {
|
|
1533
|
+
|
|
1534
|
+
case 'center':
|
|
1535
|
+
transformData.center.set( fieldValues[ 0 ], fieldValues[ 1 ] );
|
|
1536
|
+
break;
|
|
1537
|
+
|
|
1538
|
+
case 'rotation':
|
|
1539
|
+
transformData.rotation = fieldValues[ 0 ];
|
|
1540
|
+
break;
|
|
1541
|
+
|
|
1542
|
+
case 'scale':
|
|
1543
|
+
transformData.scale.set( fieldValues[ 0 ], fieldValues[ 1 ] );
|
|
1544
|
+
break;
|
|
1545
|
+
|
|
1546
|
+
case 'translation':
|
|
1547
|
+
transformData.translation.set( fieldValues[ 0 ], fieldValues[ 1 ] );
|
|
1548
|
+
break;
|
|
1549
|
+
|
|
1550
|
+
default:
|
|
1551
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1552
|
+
break;
|
|
1553
|
+
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
return transformData;
|
|
1559
|
+
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
function buildGeometricNode( node ) {
|
|
1563
|
+
|
|
1564
|
+
return node.fields[ 0 ].values;
|
|
1565
|
+
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
function buildWorldInfoNode( node ) {
|
|
1569
|
+
|
|
1570
|
+
const worldInfo = {};
|
|
1571
|
+
|
|
1572
|
+
const fields = node.fields;
|
|
1573
|
+
|
|
1574
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1575
|
+
|
|
1576
|
+
const field = fields[ i ];
|
|
1577
|
+
const fieldName = field.name;
|
|
1578
|
+
const fieldValues = field.values;
|
|
1579
|
+
|
|
1580
|
+
switch ( fieldName ) {
|
|
1581
|
+
|
|
1582
|
+
case 'title':
|
|
1583
|
+
worldInfo.title = fieldValues[ 0 ];
|
|
1584
|
+
break;
|
|
1585
|
+
|
|
1586
|
+
case 'info':
|
|
1587
|
+
worldInfo.info = fieldValues;
|
|
1588
|
+
break;
|
|
1589
|
+
|
|
1590
|
+
default:
|
|
1591
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1592
|
+
break;
|
|
1593
|
+
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
return worldInfo;
|
|
1599
|
+
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
function buildCamera( node, type ) {
|
|
1603
|
+
|
|
1604
|
+
const camera = ( type === 'PerspectiveCamera' ) ? new PerspectiveCamera() : new OrthographicCamera();
|
|
1605
|
+
|
|
1606
|
+
const width = ( typeof window !== 'undefined' ) ? window.innerWidth : 1;
|
|
1607
|
+
const height = ( typeof window !== 'undefined' ) ? window.innerHeight : 1;
|
|
1608
|
+
const aspect = width / height;
|
|
1609
|
+
|
|
1610
|
+
const fields = node.fields;
|
|
1611
|
+
|
|
1612
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1613
|
+
|
|
1614
|
+
const field = fields[ i ];
|
|
1615
|
+
const fieldName = field.name;
|
|
1616
|
+
const fieldValues = field.values;
|
|
1617
|
+
|
|
1618
|
+
switch ( fieldName ) {
|
|
1619
|
+
|
|
1620
|
+
case 'position':
|
|
1621
|
+
camera.position.set( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 0 ] );
|
|
1622
|
+
break;
|
|
1623
|
+
|
|
1624
|
+
case 'orientation':
|
|
1625
|
+
const axis = new Vector3( fieldValues[ 0 ], fieldValues[ 1 ], fieldValues[ 2 ] ).normalize();
|
|
1626
|
+
const angle = fieldValues[ 3 ];
|
|
1627
|
+
camera.quaternion.setFromAxisAngle( axis, angle );
|
|
1628
|
+
break;
|
|
1629
|
+
|
|
1630
|
+
case 'focalDistance':
|
|
1631
|
+
camera.userData.focalDistance = fieldValues[ 0 ]; // might be useful for DoF
|
|
1632
|
+
break;
|
|
1633
|
+
|
|
1634
|
+
case 'heightAngle':
|
|
1635
|
+
|
|
1636
|
+
// for perspective cams only
|
|
1637
|
+
|
|
1638
|
+
camera.fov = MathUtils.radToDeg( fieldValues[ 0 ] );
|
|
1639
|
+
camera.aspect = aspect;
|
|
1640
|
+
camera.updateProjectionMatrix();
|
|
1641
|
+
|
|
1642
|
+
break;
|
|
1643
|
+
|
|
1644
|
+
case 'height':
|
|
1645
|
+
|
|
1646
|
+
// for ortho cams only
|
|
1647
|
+
|
|
1648
|
+
const halfHeight = fieldValues[ 0 ] / 2;
|
|
1649
|
+
const halfWidth = halfHeight * aspect;
|
|
1650
|
+
|
|
1651
|
+
camera.left = - halfWidth;
|
|
1652
|
+
camera.right = halfWidth;
|
|
1653
|
+
camera.top = halfHeight;
|
|
1654
|
+
camera.bottom = - halfHeight;
|
|
1655
|
+
camera.updateProjectionMatrix();
|
|
1656
|
+
break;
|
|
1657
|
+
|
|
1658
|
+
default:
|
|
1659
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1660
|
+
break;
|
|
1661
|
+
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
return camera;
|
|
1667
|
+
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
function buildIndexedFaceSetNode( node ) {
|
|
1671
|
+
|
|
1672
|
+
let color, coord, normal, texCoord;
|
|
1673
|
+
let ccw = true, solid = true, creaseAngle = 0;
|
|
1674
|
+
let colorIndex, coordIndex, normalIndex, texCoordIndex;
|
|
1675
|
+
let colorPerVertex = true, normalPerVertex = true;
|
|
1676
|
+
|
|
1677
|
+
const fields = node.fields;
|
|
1678
|
+
|
|
1679
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1680
|
+
|
|
1681
|
+
const field = fields[ i ];
|
|
1682
|
+
const fieldName = field.name;
|
|
1683
|
+
const fieldValues = field.values;
|
|
1684
|
+
|
|
1685
|
+
switch ( fieldName ) {
|
|
1686
|
+
|
|
1687
|
+
case 'color':
|
|
1688
|
+
const colorNode = fieldValues[ 0 ];
|
|
1689
|
+
|
|
1690
|
+
if ( colorNode !== null ) {
|
|
1691
|
+
|
|
1692
|
+
color = getNode( colorNode );
|
|
1693
|
+
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
break;
|
|
1697
|
+
|
|
1698
|
+
case 'coord':
|
|
1699
|
+
const coordNode = fieldValues[ 0 ];
|
|
1700
|
+
|
|
1701
|
+
if ( coordNode !== null ) {
|
|
1702
|
+
|
|
1703
|
+
coord = getNode( coordNode );
|
|
1704
|
+
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
break;
|
|
1708
|
+
|
|
1709
|
+
case 'normal':
|
|
1710
|
+
const normalNode = fieldValues[ 0 ];
|
|
1711
|
+
|
|
1712
|
+
if ( normalNode !== null ) {
|
|
1713
|
+
|
|
1714
|
+
normal = getNode( normalNode );
|
|
1715
|
+
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
break;
|
|
1719
|
+
|
|
1720
|
+
case 'texCoord':
|
|
1721
|
+
const texCoordNode = fieldValues[ 0 ];
|
|
1722
|
+
|
|
1723
|
+
if ( texCoordNode !== null ) {
|
|
1724
|
+
|
|
1725
|
+
texCoord = getNode( texCoordNode );
|
|
1726
|
+
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
break;
|
|
1730
|
+
|
|
1731
|
+
case 'ccw':
|
|
1732
|
+
ccw = fieldValues[ 0 ];
|
|
1733
|
+
break;
|
|
1734
|
+
|
|
1735
|
+
case 'colorIndex':
|
|
1736
|
+
colorIndex = fieldValues;
|
|
1737
|
+
break;
|
|
1738
|
+
|
|
1739
|
+
case 'colorPerVertex':
|
|
1740
|
+
colorPerVertex = fieldValues[ 0 ];
|
|
1741
|
+
break;
|
|
1742
|
+
|
|
1743
|
+
case 'convex':
|
|
1744
|
+
// field not supported
|
|
1745
|
+
break;
|
|
1746
|
+
|
|
1747
|
+
case 'coordIndex':
|
|
1748
|
+
coordIndex = fieldValues;
|
|
1749
|
+
break;
|
|
1750
|
+
|
|
1751
|
+
case 'creaseAngle':
|
|
1752
|
+
creaseAngle = fieldValues[ 0 ];
|
|
1753
|
+
break;
|
|
1754
|
+
|
|
1755
|
+
case 'normalIndex':
|
|
1756
|
+
normalIndex = fieldValues;
|
|
1757
|
+
break;
|
|
1758
|
+
|
|
1759
|
+
case 'normalPerVertex':
|
|
1760
|
+
normalPerVertex = fieldValues[ 0 ];
|
|
1761
|
+
break;
|
|
1762
|
+
|
|
1763
|
+
case 'solid':
|
|
1764
|
+
solid = fieldValues[ 0 ];
|
|
1765
|
+
break;
|
|
1766
|
+
|
|
1767
|
+
case 'texCoordIndex':
|
|
1768
|
+
texCoordIndex = fieldValues;
|
|
1769
|
+
break;
|
|
1770
|
+
|
|
1771
|
+
default:
|
|
1772
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1773
|
+
break;
|
|
1774
|
+
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
if ( coordIndex === undefined ) {
|
|
1780
|
+
|
|
1781
|
+
console.warn( 'THREE.VRMLLoader: Missing coordIndex.' );
|
|
1782
|
+
|
|
1783
|
+
return new BufferGeometry(); // handle VRML files with incomplete geometry definition
|
|
1784
|
+
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
const triangulatedCoordIndex = triangulateFaceIndex( coordIndex, ccw );
|
|
1788
|
+
|
|
1789
|
+
let colorAttribute;
|
|
1790
|
+
let normalAttribute;
|
|
1791
|
+
let uvAttribute;
|
|
1792
|
+
|
|
1793
|
+
if ( color ) {
|
|
1794
|
+
|
|
1795
|
+
if ( colorPerVertex === true ) {
|
|
1796
|
+
|
|
1797
|
+
if ( colorIndex && colorIndex.length > 0 ) {
|
|
1798
|
+
|
|
1799
|
+
// if the colorIndex field is not empty, then it is used to choose colors for each vertex of the IndexedFaceSet.
|
|
1800
|
+
|
|
1801
|
+
const triangulatedColorIndex = triangulateFaceIndex( colorIndex, ccw );
|
|
1802
|
+
colorAttribute = computeAttributeFromIndexedData( triangulatedCoordIndex, triangulatedColorIndex, color, 3 );
|
|
1803
|
+
|
|
1804
|
+
} else {
|
|
1805
|
+
|
|
1806
|
+
// if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
|
|
1807
|
+
|
|
1808
|
+
colorAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new Float32BufferAttribute( color, 3 ) );
|
|
1809
|
+
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
} else {
|
|
1813
|
+
|
|
1814
|
+
if ( colorIndex && colorIndex.length > 0 ) {
|
|
1815
|
+
|
|
1816
|
+
// if the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet
|
|
1817
|
+
|
|
1818
|
+
const flattenFaceColors = flattenData( color, colorIndex );
|
|
1819
|
+
const triangulatedFaceColors = triangulateFaceData( flattenFaceColors, coordIndex );
|
|
1820
|
+
colorAttribute = computeAttributeFromFaceData( triangulatedCoordIndex, triangulatedFaceColors );
|
|
1821
|
+
|
|
1822
|
+
} else {
|
|
1823
|
+
|
|
1824
|
+
// if the colorIndex field is empty, then the color are applied to each face of the IndexedFaceSet in order
|
|
1825
|
+
|
|
1826
|
+
const triangulatedFaceColors = triangulateFaceData( color, coordIndex );
|
|
1827
|
+
colorAttribute = computeAttributeFromFaceData( triangulatedCoordIndex, triangulatedFaceColors );
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
1835
|
+
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
if ( normal ) {
|
|
1839
|
+
|
|
1840
|
+
if ( normalPerVertex === true ) {
|
|
1841
|
+
|
|
1842
|
+
// consider vertex normals
|
|
1843
|
+
|
|
1844
|
+
if ( normalIndex && normalIndex.length > 0 ) {
|
|
1845
|
+
|
|
1846
|
+
// if the normalIndex field is not empty, then it is used to choose normals for each vertex of the IndexedFaceSet.
|
|
1847
|
+
|
|
1848
|
+
const triangulatedNormalIndex = triangulateFaceIndex( normalIndex, ccw );
|
|
1849
|
+
normalAttribute = computeAttributeFromIndexedData( triangulatedCoordIndex, triangulatedNormalIndex, normal, 3 );
|
|
1850
|
+
|
|
1851
|
+
} else {
|
|
1852
|
+
|
|
1853
|
+
// if the normalIndex field is empty, then the coordIndex field is used to choose normals from the Normal node
|
|
1854
|
+
|
|
1855
|
+
normalAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new Float32BufferAttribute( normal, 3 ) );
|
|
1856
|
+
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
} else {
|
|
1860
|
+
|
|
1861
|
+
// consider face normals
|
|
1862
|
+
|
|
1863
|
+
if ( normalIndex && normalIndex.length > 0 ) {
|
|
1864
|
+
|
|
1865
|
+
// if the normalIndex field is not empty, then they are used to choose one normal for each face of the IndexedFaceSet
|
|
1866
|
+
|
|
1867
|
+
const flattenFaceNormals = flattenData( normal, normalIndex );
|
|
1868
|
+
const triangulatedFaceNormals = triangulateFaceData( flattenFaceNormals, coordIndex );
|
|
1869
|
+
normalAttribute = computeAttributeFromFaceData( triangulatedCoordIndex, triangulatedFaceNormals );
|
|
1870
|
+
|
|
1871
|
+
} else {
|
|
1872
|
+
|
|
1873
|
+
// if the normalIndex field is empty, then the normals are applied to each face of the IndexedFaceSet in order
|
|
1874
|
+
|
|
1875
|
+
const triangulatedFaceNormals = triangulateFaceData( normal, coordIndex );
|
|
1876
|
+
normalAttribute = computeAttributeFromFaceData( triangulatedCoordIndex, triangulatedFaceNormals );
|
|
1877
|
+
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
} else {
|
|
1883
|
+
|
|
1884
|
+
// if the normal field is NULL, then the loader should automatically generate normals, using creaseAngle to determine if and how normals are smoothed across shared vertices
|
|
1885
|
+
|
|
1886
|
+
normalAttribute = computeNormalAttribute( triangulatedCoordIndex, coord, creaseAngle );
|
|
1887
|
+
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
if ( texCoord ) {
|
|
1891
|
+
|
|
1892
|
+
// texture coordinates are always defined on vertex level
|
|
1893
|
+
|
|
1894
|
+
if ( texCoordIndex && texCoordIndex.length > 0 ) {
|
|
1895
|
+
|
|
1896
|
+
// if the texCoordIndex field is not empty, then it is used to choose texture coordinates for each vertex of the IndexedFaceSet.
|
|
1897
|
+
|
|
1898
|
+
const triangulatedTexCoordIndex = triangulateFaceIndex( texCoordIndex, ccw );
|
|
1899
|
+
uvAttribute = computeAttributeFromIndexedData( triangulatedCoordIndex, triangulatedTexCoordIndex, texCoord, 2 );
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
} else {
|
|
1903
|
+
|
|
1904
|
+
// if the texCoordIndex field is empty, then the coordIndex array is used to choose texture coordinates from the TextureCoordinate node
|
|
1905
|
+
|
|
1906
|
+
uvAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new Float32BufferAttribute( texCoord, 2 ) );
|
|
1907
|
+
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
const geometry = new BufferGeometry();
|
|
1913
|
+
const positionAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new Float32BufferAttribute( coord, 3 ) );
|
|
1914
|
+
|
|
1915
|
+
geometry.setAttribute( 'position', positionAttribute );
|
|
1916
|
+
geometry.setAttribute( 'normal', normalAttribute );
|
|
1917
|
+
|
|
1918
|
+
// optional attributes
|
|
1919
|
+
|
|
1920
|
+
if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
|
|
1921
|
+
if ( uvAttribute ) geometry.setAttribute( 'uv', uvAttribute );
|
|
1922
|
+
|
|
1923
|
+
// "solid" influences the material so let's store it for later use
|
|
1924
|
+
|
|
1925
|
+
geometry._solid = solid;
|
|
1926
|
+
geometry._type = 'mesh';
|
|
1927
|
+
|
|
1928
|
+
return geometry;
|
|
1929
|
+
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
function buildIndexedLineSetNode( node ) {
|
|
1933
|
+
|
|
1934
|
+
let color, coord;
|
|
1935
|
+
let colorIndex, coordIndex;
|
|
1936
|
+
let colorPerVertex = true;
|
|
1937
|
+
|
|
1938
|
+
const fields = node.fields;
|
|
1939
|
+
|
|
1940
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
1941
|
+
|
|
1942
|
+
const field = fields[ i ];
|
|
1943
|
+
const fieldName = field.name;
|
|
1944
|
+
const fieldValues = field.values;
|
|
1945
|
+
|
|
1946
|
+
switch ( fieldName ) {
|
|
1947
|
+
|
|
1948
|
+
case 'color':
|
|
1949
|
+
const colorNode = fieldValues[ 0 ];
|
|
1950
|
+
|
|
1951
|
+
if ( colorNode !== null ) {
|
|
1952
|
+
|
|
1953
|
+
color = getNode( colorNode );
|
|
1954
|
+
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
break;
|
|
1958
|
+
|
|
1959
|
+
case 'coord':
|
|
1960
|
+
const coordNode = fieldValues[ 0 ];
|
|
1961
|
+
|
|
1962
|
+
if ( coordNode !== null ) {
|
|
1963
|
+
|
|
1964
|
+
coord = getNode( coordNode );
|
|
1965
|
+
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
break;
|
|
1969
|
+
|
|
1970
|
+
case 'colorIndex':
|
|
1971
|
+
colorIndex = fieldValues;
|
|
1972
|
+
break;
|
|
1973
|
+
|
|
1974
|
+
case 'colorPerVertex':
|
|
1975
|
+
colorPerVertex = fieldValues[ 0 ];
|
|
1976
|
+
break;
|
|
1977
|
+
|
|
1978
|
+
case 'coordIndex':
|
|
1979
|
+
coordIndex = fieldValues;
|
|
1980
|
+
break;
|
|
1981
|
+
|
|
1982
|
+
default:
|
|
1983
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
1984
|
+
break;
|
|
1985
|
+
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
// build lines
|
|
1991
|
+
|
|
1992
|
+
let colorAttribute;
|
|
1993
|
+
|
|
1994
|
+
const expandedLineIndex = expandLineIndex( coordIndex ); // create an index for three.js's linesegment primitive
|
|
1995
|
+
|
|
1996
|
+
if ( color ) {
|
|
1997
|
+
|
|
1998
|
+
if ( colorPerVertex === true ) {
|
|
1999
|
+
|
|
2000
|
+
if ( colorIndex.length > 0 ) {
|
|
2001
|
+
|
|
2002
|
+
// if the colorIndex field is not empty, then one color is used for each polyline of the IndexedLineSet.
|
|
2003
|
+
|
|
2004
|
+
const expandedColorIndex = expandLineIndex( colorIndex ); // compute colors for each line segment (rendering primitive)
|
|
2005
|
+
colorAttribute = computeAttributeFromIndexedData( expandedLineIndex, expandedColorIndex, color, 3 ); // compute data on vertex level
|
|
2006
|
+
|
|
2007
|
+
} else {
|
|
2008
|
+
|
|
2009
|
+
// if the colorIndex field is empty, then the colors are applied to each polyline of the IndexedLineSet in order.
|
|
2010
|
+
|
|
2011
|
+
colorAttribute = toNonIndexedAttribute( expandedLineIndex, new Float32BufferAttribute( color, 3 ) );
|
|
2012
|
+
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
} else {
|
|
2016
|
+
|
|
2017
|
+
if ( colorIndex.length > 0 ) {
|
|
2018
|
+
|
|
2019
|
+
// if the colorIndex field is not empty, then colors are applied to each vertex of the IndexedLineSet
|
|
2020
|
+
|
|
2021
|
+
const flattenLineColors = flattenData( color, colorIndex ); // compute colors for each VRML primitive
|
|
2022
|
+
const expandedLineColors = expandLineData( flattenLineColors, coordIndex ); // compute colors for each line segment (rendering primitive)
|
|
2023
|
+
colorAttribute = computeAttributeFromLineData( expandedLineIndex, expandedLineColors ); // compute data on vertex level
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
} else {
|
|
2027
|
+
|
|
2028
|
+
// if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
|
|
2029
|
+
|
|
2030
|
+
const expandedLineColors = expandLineData( color, coordIndex ); // compute colors for each line segment (rendering primitive)
|
|
2031
|
+
colorAttribute = computeAttributeFromLineData( expandedLineIndex, expandedLineColors ); // compute data on vertex level
|
|
2032
|
+
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
2038
|
+
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
//
|
|
2042
|
+
|
|
2043
|
+
const geometry = new BufferGeometry();
|
|
2044
|
+
|
|
2045
|
+
const positionAttribute = toNonIndexedAttribute( expandedLineIndex, new Float32BufferAttribute( coord, 3 ) );
|
|
2046
|
+
geometry.setAttribute( 'position', positionAttribute );
|
|
2047
|
+
|
|
2048
|
+
if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
|
|
2049
|
+
|
|
2050
|
+
geometry._type = 'line';
|
|
2051
|
+
|
|
2052
|
+
return geometry;
|
|
2053
|
+
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
function buildPointSetNode( node ) {
|
|
2057
|
+
|
|
2058
|
+
let color, coord;
|
|
2059
|
+
|
|
2060
|
+
const fields = node.fields;
|
|
2061
|
+
|
|
2062
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2063
|
+
|
|
2064
|
+
const field = fields[ i ];
|
|
2065
|
+
const fieldName = field.name;
|
|
2066
|
+
const fieldValues = field.values;
|
|
2067
|
+
|
|
2068
|
+
switch ( fieldName ) {
|
|
2069
|
+
|
|
2070
|
+
case 'color':
|
|
2071
|
+
const colorNode = fieldValues[ 0 ];
|
|
2072
|
+
|
|
2073
|
+
if ( colorNode !== null ) {
|
|
2074
|
+
|
|
2075
|
+
color = getNode( colorNode );
|
|
2076
|
+
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
break;
|
|
2080
|
+
|
|
2081
|
+
case 'coord':
|
|
2082
|
+
const coordNode = fieldValues[ 0 ];
|
|
2083
|
+
|
|
2084
|
+
if ( coordNode !== null ) {
|
|
2085
|
+
|
|
2086
|
+
coord = getNode( coordNode );
|
|
2087
|
+
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
break;
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
default:
|
|
2094
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2095
|
+
break;
|
|
2096
|
+
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
const geometry = new BufferGeometry();
|
|
2102
|
+
|
|
2103
|
+
geometry.setAttribute( 'position', new Float32BufferAttribute( coord, 3 ) );
|
|
2104
|
+
|
|
2105
|
+
if ( color ) {
|
|
2106
|
+
|
|
2107
|
+
const colorAttribute = new Float32BufferAttribute( color, 3 );
|
|
2108
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
2109
|
+
|
|
2110
|
+
geometry.setAttribute( 'color', colorAttribute );
|
|
2111
|
+
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
geometry._type = 'points';
|
|
2115
|
+
|
|
2116
|
+
return geometry;
|
|
2117
|
+
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
function buildBoxNode( node ) {
|
|
2121
|
+
|
|
2122
|
+
const size = new Vector3( 2, 2, 2 );
|
|
2123
|
+
|
|
2124
|
+
const fields = node.fields;
|
|
2125
|
+
|
|
2126
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2127
|
+
|
|
2128
|
+
const field = fields[ i ];
|
|
2129
|
+
const fieldName = field.name;
|
|
2130
|
+
const fieldValues = field.values;
|
|
2131
|
+
|
|
2132
|
+
switch ( fieldName ) {
|
|
2133
|
+
|
|
2134
|
+
case 'size':
|
|
2135
|
+
size.x = fieldValues[ 0 ];
|
|
2136
|
+
size.y = fieldValues[ 1 ];
|
|
2137
|
+
size.z = fieldValues[ 2 ];
|
|
2138
|
+
break;
|
|
2139
|
+
|
|
2140
|
+
default:
|
|
2141
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2142
|
+
break;
|
|
2143
|
+
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
const geometry = new BoxGeometry( size.x, size.y, size.z );
|
|
2149
|
+
|
|
2150
|
+
return geometry;
|
|
2151
|
+
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
function buildConeNode( node ) {
|
|
2155
|
+
|
|
2156
|
+
let radius = 1, height = 2, openEnded = false;
|
|
2157
|
+
|
|
2158
|
+
const fields = node.fields;
|
|
2159
|
+
|
|
2160
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2161
|
+
|
|
2162
|
+
const field = fields[ i ];
|
|
2163
|
+
const fieldName = field.name;
|
|
2164
|
+
const fieldValues = field.values;
|
|
2165
|
+
|
|
2166
|
+
switch ( fieldName ) {
|
|
2167
|
+
|
|
2168
|
+
case 'bottom':
|
|
2169
|
+
openEnded = ! fieldValues[ 0 ];
|
|
2170
|
+
break;
|
|
2171
|
+
|
|
2172
|
+
case 'bottomRadius':
|
|
2173
|
+
radius = fieldValues[ 0 ];
|
|
2174
|
+
break;
|
|
2175
|
+
|
|
2176
|
+
case 'height':
|
|
2177
|
+
height = fieldValues[ 0 ];
|
|
2178
|
+
break;
|
|
2179
|
+
|
|
2180
|
+
case 'side':
|
|
2181
|
+
// field not supported
|
|
2182
|
+
break;
|
|
2183
|
+
|
|
2184
|
+
default:
|
|
2185
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2186
|
+
break;
|
|
2187
|
+
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
const geometry = new ConeGeometry( radius, height, 16, 1, openEnded );
|
|
2193
|
+
|
|
2194
|
+
return geometry;
|
|
2195
|
+
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
function buildCylinderNode( node ) {
|
|
2199
|
+
|
|
2200
|
+
let radius = 1, height = 2;
|
|
2201
|
+
|
|
2202
|
+
const fields = node.fields;
|
|
2203
|
+
|
|
2204
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2205
|
+
|
|
2206
|
+
const field = fields[ i ];
|
|
2207
|
+
const fieldName = field.name;
|
|
2208
|
+
const fieldValues = field.values;
|
|
2209
|
+
|
|
2210
|
+
switch ( fieldName ) {
|
|
2211
|
+
|
|
2212
|
+
case 'bottom':
|
|
2213
|
+
// field not supported
|
|
2214
|
+
break;
|
|
2215
|
+
|
|
2216
|
+
case 'radius':
|
|
2217
|
+
radius = fieldValues[ 0 ];
|
|
2218
|
+
break;
|
|
2219
|
+
|
|
2220
|
+
case 'height':
|
|
2221
|
+
height = fieldValues[ 0 ];
|
|
2222
|
+
break;
|
|
2223
|
+
|
|
2224
|
+
case 'side':
|
|
2225
|
+
// field not supported
|
|
2226
|
+
break;
|
|
2227
|
+
|
|
2228
|
+
case 'top':
|
|
2229
|
+
// field not supported
|
|
2230
|
+
break;
|
|
2231
|
+
|
|
2232
|
+
default:
|
|
2233
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2234
|
+
break;
|
|
2235
|
+
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
const geometry = new CylinderGeometry( radius, radius, height, 16, 1 );
|
|
2241
|
+
|
|
2242
|
+
return geometry;
|
|
2243
|
+
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
function buildSphereNode( node ) {
|
|
2247
|
+
|
|
2248
|
+
let radius = 1;
|
|
2249
|
+
|
|
2250
|
+
const fields = node.fields;
|
|
2251
|
+
|
|
2252
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2253
|
+
|
|
2254
|
+
const field = fields[ i ];
|
|
2255
|
+
const fieldName = field.name;
|
|
2256
|
+
const fieldValues = field.values;
|
|
2257
|
+
|
|
2258
|
+
switch ( fieldName ) {
|
|
2259
|
+
|
|
2260
|
+
case 'radius':
|
|
2261
|
+
radius = fieldValues[ 0 ];
|
|
2262
|
+
break;
|
|
2263
|
+
|
|
2264
|
+
default:
|
|
2265
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2266
|
+
break;
|
|
2267
|
+
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
const geometry = new SphereGeometry( radius, 16, 16 );
|
|
2273
|
+
|
|
2274
|
+
return geometry;
|
|
2275
|
+
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
function buildElevationGridNode( node ) {
|
|
2279
|
+
|
|
2280
|
+
let color;
|
|
2281
|
+
let normal;
|
|
2282
|
+
let texCoord;
|
|
2283
|
+
let height;
|
|
2284
|
+
|
|
2285
|
+
let colorPerVertex = true;
|
|
2286
|
+
let normalPerVertex = true;
|
|
2287
|
+
let solid = true;
|
|
2288
|
+
let ccw = true;
|
|
2289
|
+
let creaseAngle = 0;
|
|
2290
|
+
let xDimension = 2;
|
|
2291
|
+
let zDimension = 2;
|
|
2292
|
+
let xSpacing = 1;
|
|
2293
|
+
let zSpacing = 1;
|
|
2294
|
+
|
|
2295
|
+
const fields = node.fields;
|
|
2296
|
+
|
|
2297
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2298
|
+
|
|
2299
|
+
const field = fields[ i ];
|
|
2300
|
+
const fieldName = field.name;
|
|
2301
|
+
const fieldValues = field.values;
|
|
2302
|
+
|
|
2303
|
+
switch ( fieldName ) {
|
|
2304
|
+
|
|
2305
|
+
case 'color':
|
|
2306
|
+
const colorNode = fieldValues[ 0 ];
|
|
2307
|
+
|
|
2308
|
+
if ( colorNode !== null ) {
|
|
2309
|
+
|
|
2310
|
+
color = getNode( colorNode );
|
|
2311
|
+
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
break;
|
|
2315
|
+
|
|
2316
|
+
case 'normal':
|
|
2317
|
+
const normalNode = fieldValues[ 0 ];
|
|
2318
|
+
|
|
2319
|
+
if ( normalNode !== null ) {
|
|
2320
|
+
|
|
2321
|
+
normal = getNode( normalNode );
|
|
2322
|
+
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
break;
|
|
2326
|
+
|
|
2327
|
+
case 'texCoord':
|
|
2328
|
+
const texCoordNode = fieldValues[ 0 ];
|
|
2329
|
+
|
|
2330
|
+
if ( texCoordNode !== null ) {
|
|
2331
|
+
|
|
2332
|
+
texCoord = getNode( texCoordNode );
|
|
2333
|
+
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
break;
|
|
2337
|
+
|
|
2338
|
+
case 'height':
|
|
2339
|
+
height = fieldValues;
|
|
2340
|
+
break;
|
|
2341
|
+
|
|
2342
|
+
case 'ccw':
|
|
2343
|
+
ccw = fieldValues[ 0 ];
|
|
2344
|
+
break;
|
|
2345
|
+
|
|
2346
|
+
case 'colorPerVertex':
|
|
2347
|
+
colorPerVertex = fieldValues[ 0 ];
|
|
2348
|
+
break;
|
|
2349
|
+
|
|
2350
|
+
case 'creaseAngle':
|
|
2351
|
+
creaseAngle = fieldValues[ 0 ];
|
|
2352
|
+
break;
|
|
2353
|
+
|
|
2354
|
+
case 'normalPerVertex':
|
|
2355
|
+
normalPerVertex = fieldValues[ 0 ];
|
|
2356
|
+
break;
|
|
2357
|
+
|
|
2358
|
+
case 'solid':
|
|
2359
|
+
solid = fieldValues[ 0 ];
|
|
2360
|
+
break;
|
|
2361
|
+
|
|
2362
|
+
case 'xDimension':
|
|
2363
|
+
xDimension = fieldValues[ 0 ];
|
|
2364
|
+
break;
|
|
2365
|
+
|
|
2366
|
+
case 'xSpacing':
|
|
2367
|
+
xSpacing = fieldValues[ 0 ];
|
|
2368
|
+
break;
|
|
2369
|
+
|
|
2370
|
+
case 'zDimension':
|
|
2371
|
+
zDimension = fieldValues[ 0 ];
|
|
2372
|
+
break;
|
|
2373
|
+
|
|
2374
|
+
case 'zSpacing':
|
|
2375
|
+
zSpacing = fieldValues[ 0 ];
|
|
2376
|
+
break;
|
|
2377
|
+
|
|
2378
|
+
default:
|
|
2379
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2380
|
+
break;
|
|
2381
|
+
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
// vertex data
|
|
2387
|
+
|
|
2388
|
+
const vertices = [];
|
|
2389
|
+
const normals = [];
|
|
2390
|
+
const colors = [];
|
|
2391
|
+
const uvs = [];
|
|
2392
|
+
|
|
2393
|
+
for ( let i = 0; i < zDimension; i ++ ) {
|
|
2394
|
+
|
|
2395
|
+
for ( let j = 0; j < xDimension; j ++ ) {
|
|
2396
|
+
|
|
2397
|
+
// compute a row major index
|
|
2398
|
+
|
|
2399
|
+
const index = ( i * xDimension ) + j;
|
|
2400
|
+
|
|
2401
|
+
// vertices
|
|
2402
|
+
|
|
2403
|
+
const x = xSpacing * i;
|
|
2404
|
+
const y = height[ index ];
|
|
2405
|
+
const z = zSpacing * j;
|
|
2406
|
+
|
|
2407
|
+
vertices.push( x, y, z );
|
|
2408
|
+
|
|
2409
|
+
// colors
|
|
2410
|
+
|
|
2411
|
+
if ( color && colorPerVertex === true ) {
|
|
2412
|
+
|
|
2413
|
+
const r = color[ index * 3 + 0 ];
|
|
2414
|
+
const g = color[ index * 3 + 1 ];
|
|
2415
|
+
const b = color[ index * 3 + 2 ];
|
|
2416
|
+
|
|
2417
|
+
colors.push( r, g, b );
|
|
2418
|
+
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
// normals
|
|
2422
|
+
|
|
2423
|
+
if ( normal && normalPerVertex === true ) {
|
|
2424
|
+
|
|
2425
|
+
const xn = normal[ index * 3 + 0 ];
|
|
2426
|
+
const yn = normal[ index * 3 + 1 ];
|
|
2427
|
+
const zn = normal[ index * 3 + 2 ];
|
|
2428
|
+
|
|
2429
|
+
normals.push( xn, yn, zn );
|
|
2430
|
+
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// uvs
|
|
2434
|
+
|
|
2435
|
+
if ( texCoord ) {
|
|
2436
|
+
|
|
2437
|
+
const s = texCoord[ index * 2 + 0 ];
|
|
2438
|
+
const t = texCoord[ index * 2 + 1 ];
|
|
2439
|
+
|
|
2440
|
+
uvs.push( s, t );
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
} else {
|
|
2444
|
+
|
|
2445
|
+
uvs.push( i / ( xDimension - 1 ), j / ( zDimension - 1 ) );
|
|
2446
|
+
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// indices
|
|
2454
|
+
|
|
2455
|
+
const indices = [];
|
|
2456
|
+
|
|
2457
|
+
for ( let i = 0; i < xDimension - 1; i ++ ) {
|
|
2458
|
+
|
|
2459
|
+
for ( let j = 0; j < zDimension - 1; j ++ ) {
|
|
2460
|
+
|
|
2461
|
+
// from https://tecfa.unige.ch/guides/vrml/vrml97/spec/part1/nodesRef.html#ElevationGrid
|
|
2462
|
+
|
|
2463
|
+
const a = i + j * xDimension;
|
|
2464
|
+
const b = i + ( j + 1 ) * xDimension;
|
|
2465
|
+
const c = ( i + 1 ) + ( j + 1 ) * xDimension;
|
|
2466
|
+
const d = ( i + 1 ) + j * xDimension;
|
|
2467
|
+
|
|
2468
|
+
// faces
|
|
2469
|
+
|
|
2470
|
+
if ( ccw === true ) {
|
|
2471
|
+
|
|
2472
|
+
indices.push( a, c, b );
|
|
2473
|
+
indices.push( c, a, d );
|
|
2474
|
+
|
|
2475
|
+
} else {
|
|
2476
|
+
|
|
2477
|
+
indices.push( a, b, c );
|
|
2478
|
+
indices.push( c, d, a );
|
|
2479
|
+
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
//
|
|
2487
|
+
|
|
2488
|
+
const positionAttribute = toNonIndexedAttribute( indices, new Float32BufferAttribute( vertices, 3 ) );
|
|
2489
|
+
const uvAttribute = toNonIndexedAttribute( indices, new Float32BufferAttribute( uvs, 2 ) );
|
|
2490
|
+
let colorAttribute;
|
|
2491
|
+
let normalAttribute;
|
|
2492
|
+
|
|
2493
|
+
// color attribute
|
|
2494
|
+
|
|
2495
|
+
if ( color ) {
|
|
2496
|
+
|
|
2497
|
+
if ( colorPerVertex === false ) {
|
|
2498
|
+
|
|
2499
|
+
for ( let i = 0; i < xDimension - 1; i ++ ) {
|
|
2500
|
+
|
|
2501
|
+
for ( let j = 0; j < zDimension - 1; j ++ ) {
|
|
2502
|
+
|
|
2503
|
+
const index = i + j * ( xDimension - 1 );
|
|
2504
|
+
|
|
2505
|
+
const r = color[ index * 3 + 0 ];
|
|
2506
|
+
const g = color[ index * 3 + 1 ];
|
|
2507
|
+
const b = color[ index * 3 + 2 ];
|
|
2508
|
+
|
|
2509
|
+
// one color per quad
|
|
2510
|
+
|
|
2511
|
+
colors.push( r, g, b ); colors.push( r, g, b ); colors.push( r, g, b );
|
|
2512
|
+
colors.push( r, g, b ); colors.push( r, g, b ); colors.push( r, g, b );
|
|
2513
|
+
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
colorAttribute = new Float32BufferAttribute( colors, 3 );
|
|
2519
|
+
|
|
2520
|
+
} else {
|
|
2521
|
+
|
|
2522
|
+
colorAttribute = toNonIndexedAttribute( indices, new Float32BufferAttribute( colors, 3 ) );
|
|
2523
|
+
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
convertColorsToLinearSRGB( colorAttribute );
|
|
2527
|
+
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
// normal attribute
|
|
2531
|
+
|
|
2532
|
+
if ( normal ) {
|
|
2533
|
+
|
|
2534
|
+
if ( normalPerVertex === false ) {
|
|
2535
|
+
|
|
2536
|
+
for ( let i = 0; i < xDimension - 1; i ++ ) {
|
|
2537
|
+
|
|
2538
|
+
for ( let j = 0; j < zDimension - 1; j ++ ) {
|
|
2539
|
+
|
|
2540
|
+
const index = i + j * ( xDimension - 1 );
|
|
2541
|
+
|
|
2542
|
+
const xn = normal[ index * 3 + 0 ];
|
|
2543
|
+
const yn = normal[ index * 3 + 1 ];
|
|
2544
|
+
const zn = normal[ index * 3 + 2 ];
|
|
2545
|
+
|
|
2546
|
+
// one normal per quad
|
|
2547
|
+
|
|
2548
|
+
normals.push( xn, yn, zn ); normals.push( xn, yn, zn ); normals.push( xn, yn, zn );
|
|
2549
|
+
normals.push( xn, yn, zn ); normals.push( xn, yn, zn ); normals.push( xn, yn, zn );
|
|
2550
|
+
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
normalAttribute = new Float32BufferAttribute( normals, 3 );
|
|
2556
|
+
|
|
2557
|
+
} else {
|
|
2558
|
+
|
|
2559
|
+
normalAttribute = toNonIndexedAttribute( indices, new Float32BufferAttribute( normals, 3 ) );
|
|
2560
|
+
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
} else {
|
|
2564
|
+
|
|
2565
|
+
normalAttribute = computeNormalAttribute( indices, vertices, creaseAngle );
|
|
2566
|
+
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
// build geometry
|
|
2570
|
+
|
|
2571
|
+
const geometry = new BufferGeometry();
|
|
2572
|
+
geometry.setAttribute( 'position', positionAttribute );
|
|
2573
|
+
geometry.setAttribute( 'normal', normalAttribute );
|
|
2574
|
+
geometry.setAttribute( 'uv', uvAttribute );
|
|
2575
|
+
|
|
2576
|
+
if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
|
|
2577
|
+
|
|
2578
|
+
// "solid" influences the material so let's store it for later use
|
|
2579
|
+
|
|
2580
|
+
geometry._solid = solid;
|
|
2581
|
+
geometry._type = 'mesh';
|
|
2582
|
+
|
|
2583
|
+
return geometry;
|
|
2584
|
+
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
function buildExtrusionNode( node ) {
|
|
2588
|
+
|
|
2589
|
+
let crossSection = [ 1, 1, 1, - 1, - 1, - 1, - 1, 1, 1, 1 ];
|
|
2590
|
+
let spine = [ 0, 0, 0, 0, 1, 0 ];
|
|
2591
|
+
let scale;
|
|
2592
|
+
let orientation;
|
|
2593
|
+
|
|
2594
|
+
let beginCap = true;
|
|
2595
|
+
let ccw = true;
|
|
2596
|
+
let creaseAngle = 0;
|
|
2597
|
+
let endCap = true;
|
|
2598
|
+
let solid = true;
|
|
2599
|
+
|
|
2600
|
+
const fields = node.fields;
|
|
2601
|
+
|
|
2602
|
+
for ( let i = 0, l = fields.length; i < l; i ++ ) {
|
|
2603
|
+
|
|
2604
|
+
const field = fields[ i ];
|
|
2605
|
+
const fieldName = field.name;
|
|
2606
|
+
const fieldValues = field.values;
|
|
2607
|
+
|
|
2608
|
+
switch ( fieldName ) {
|
|
2609
|
+
|
|
2610
|
+
case 'beginCap':
|
|
2611
|
+
beginCap = fieldValues[ 0 ];
|
|
2612
|
+
break;
|
|
2613
|
+
|
|
2614
|
+
case 'ccw':
|
|
2615
|
+
ccw = fieldValues[ 0 ];
|
|
2616
|
+
break;
|
|
2617
|
+
|
|
2618
|
+
case 'convex':
|
|
2619
|
+
// field not supported
|
|
2620
|
+
break;
|
|
2621
|
+
|
|
2622
|
+
case 'creaseAngle':
|
|
2623
|
+
creaseAngle = fieldValues[ 0 ];
|
|
2624
|
+
break;
|
|
2625
|
+
|
|
2626
|
+
case 'crossSection':
|
|
2627
|
+
crossSection = fieldValues;
|
|
2628
|
+
break;
|
|
2629
|
+
|
|
2630
|
+
case 'endCap':
|
|
2631
|
+
endCap = fieldValues[ 0 ];
|
|
2632
|
+
break;
|
|
2633
|
+
|
|
2634
|
+
case 'orientation':
|
|
2635
|
+
orientation = fieldValues;
|
|
2636
|
+
break;
|
|
2637
|
+
|
|
2638
|
+
case 'scale':
|
|
2639
|
+
scale = fieldValues;
|
|
2640
|
+
break;
|
|
2641
|
+
|
|
2642
|
+
case 'solid':
|
|
2643
|
+
solid = fieldValues[ 0 ];
|
|
2644
|
+
break;
|
|
2645
|
+
|
|
2646
|
+
case 'spine':
|
|
2647
|
+
spine = fieldValues; // only extrusion along the Y-axis are supported so far
|
|
2648
|
+
break;
|
|
2649
|
+
|
|
2650
|
+
default:
|
|
2651
|
+
console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
|
|
2652
|
+
break;
|
|
2653
|
+
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
const crossSectionClosed = ( crossSection[ 0 ] === crossSection[ crossSection.length - 2 ] && crossSection[ 1 ] === crossSection[ crossSection.length - 1 ] );
|
|
2659
|
+
|
|
2660
|
+
// vertices
|
|
2661
|
+
|
|
2662
|
+
const vertices = [];
|
|
2663
|
+
const spineVector = new Vector3();
|
|
2664
|
+
const scaling = new Vector3();
|
|
2665
|
+
|
|
2666
|
+
const axis = new Vector3();
|
|
2667
|
+
const vertex = new Vector3();
|
|
2668
|
+
const quaternion = new Quaternion();
|
|
2669
|
+
|
|
2670
|
+
for ( let i = 0, j = 0, o = 0, il = spine.length; i < il; i += 3, j += 2, o += 4 ) {
|
|
2671
|
+
|
|
2672
|
+
spineVector.fromArray( spine, i );
|
|
2673
|
+
|
|
2674
|
+
scaling.x = scale ? scale[ j + 0 ] : 1;
|
|
2675
|
+
scaling.y = 1;
|
|
2676
|
+
scaling.z = scale ? scale[ j + 1 ] : 1;
|
|
2677
|
+
|
|
2678
|
+
axis.x = orientation ? orientation[ o + 0 ] : 0;
|
|
2679
|
+
axis.y = orientation ? orientation[ o + 1 ] : 0;
|
|
2680
|
+
axis.z = orientation ? orientation[ o + 2 ] : 1;
|
|
2681
|
+
const angle = orientation ? orientation[ o + 3 ] : 0;
|
|
2682
|
+
|
|
2683
|
+
for ( let k = 0, kl = crossSection.length; k < kl; k += 2 ) {
|
|
2684
|
+
|
|
2685
|
+
vertex.x = crossSection[ k + 0 ];
|
|
2686
|
+
vertex.y = 0;
|
|
2687
|
+
vertex.z = crossSection[ k + 1 ];
|
|
2688
|
+
|
|
2689
|
+
// scale
|
|
2690
|
+
|
|
2691
|
+
vertex.multiply( scaling );
|
|
2692
|
+
|
|
2693
|
+
// rotate
|
|
2694
|
+
|
|
2695
|
+
quaternion.setFromAxisAngle( axis, angle );
|
|
2696
|
+
vertex.applyQuaternion( quaternion );
|
|
2697
|
+
|
|
2698
|
+
// translate
|
|
2699
|
+
|
|
2700
|
+
vertex.add( spineVector );
|
|
2701
|
+
|
|
2702
|
+
vertices.push( vertex.x, vertex.y, vertex.z );
|
|
2703
|
+
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
// indices
|
|
2709
|
+
|
|
2710
|
+
const indices = [];
|
|
2711
|
+
|
|
2712
|
+
const spineCount = spine.length / 3;
|
|
2713
|
+
const crossSectionCount = crossSection.length / 2;
|
|
2714
|
+
|
|
2715
|
+
for ( let i = 0; i < spineCount - 1; i ++ ) {
|
|
2716
|
+
|
|
2717
|
+
for ( let j = 0; j < crossSectionCount - 1; j ++ ) {
|
|
2718
|
+
|
|
2719
|
+
const a = j + i * crossSectionCount;
|
|
2720
|
+
let b = ( j + 1 ) + i * crossSectionCount;
|
|
2721
|
+
const c = j + ( i + 1 ) * crossSectionCount;
|
|
2722
|
+
let d = ( j + 1 ) + ( i + 1 ) * crossSectionCount;
|
|
2723
|
+
|
|
2724
|
+
if ( ( j === crossSectionCount - 2 ) && ( crossSectionClosed === true ) ) {
|
|
2725
|
+
|
|
2726
|
+
b = i * crossSectionCount;
|
|
2727
|
+
d = ( i + 1 ) * crossSectionCount;
|
|
2728
|
+
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
if ( ccw === true ) {
|
|
2732
|
+
|
|
2733
|
+
indices.push( a, b, c );
|
|
2734
|
+
indices.push( c, b, d );
|
|
2735
|
+
|
|
2736
|
+
} else {
|
|
2737
|
+
|
|
2738
|
+
indices.push( a, c, b );
|
|
2739
|
+
indices.push( c, d, b );
|
|
2740
|
+
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
// triangulate cap
|
|
2748
|
+
|
|
2749
|
+
if ( beginCap === true || endCap === true ) {
|
|
2750
|
+
|
|
2751
|
+
const contour = [];
|
|
2752
|
+
|
|
2753
|
+
for ( let i = 0, l = crossSection.length; i < l; i += 2 ) {
|
|
2754
|
+
|
|
2755
|
+
contour.push( new Vector2( crossSection[ i ], crossSection[ i + 1 ] ) );
|
|
2756
|
+
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
const faces = ShapeUtils.triangulateShape( contour, [] );
|
|
2760
|
+
const capIndices = [];
|
|
2761
|
+
|
|
2762
|
+
for ( let i = 0, l = faces.length; i < l; i ++ ) {
|
|
2763
|
+
|
|
2764
|
+
const face = faces[ i ];
|
|
2765
|
+
|
|
2766
|
+
capIndices.push( face[ 0 ], face[ 1 ], face[ 2 ] );
|
|
2767
|
+
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
// begin cap
|
|
2771
|
+
|
|
2772
|
+
if ( beginCap === true ) {
|
|
2773
|
+
|
|
2774
|
+
for ( let i = 0, l = capIndices.length; i < l; i += 3 ) {
|
|
2775
|
+
|
|
2776
|
+
if ( ccw === true ) {
|
|
2777
|
+
|
|
2778
|
+
indices.push( capIndices[ i + 0 ], capIndices[ i + 1 ], capIndices[ i + 2 ] );
|
|
2779
|
+
|
|
2780
|
+
} else {
|
|
2781
|
+
|
|
2782
|
+
indices.push( capIndices[ i + 0 ], capIndices[ i + 2 ], capIndices[ i + 1 ] );
|
|
2783
|
+
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
// end cap
|
|
2791
|
+
|
|
2792
|
+
if ( endCap === true ) {
|
|
2793
|
+
|
|
2794
|
+
const indexOffset = crossSectionCount * ( spineCount - 1 ); // references to the first vertex of the last cross section
|
|
2795
|
+
|
|
2796
|
+
for ( let i = 0, l = capIndices.length; i < l; i += 3 ) {
|
|
2797
|
+
|
|
2798
|
+
if ( ccw === true ) {
|
|
2799
|
+
|
|
2800
|
+
indices.push( indexOffset + capIndices[ i + 0 ], indexOffset + capIndices[ i + 2 ], indexOffset + capIndices[ i + 1 ] );
|
|
2801
|
+
|
|
2802
|
+
} else {
|
|
2803
|
+
|
|
2804
|
+
indices.push( indexOffset + capIndices[ i + 0 ], indexOffset + capIndices[ i + 1 ], indexOffset + capIndices[ i + 2 ] );
|
|
2805
|
+
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
const positionAttribute = toNonIndexedAttribute( indices, new Float32BufferAttribute( vertices, 3 ) );
|
|
2815
|
+
const normalAttribute = computeNormalAttribute( indices, vertices, creaseAngle );
|
|
2816
|
+
|
|
2817
|
+
const geometry = new BufferGeometry();
|
|
2818
|
+
geometry.setAttribute( 'position', positionAttribute );
|
|
2819
|
+
geometry.setAttribute( 'normal', normalAttribute );
|
|
2820
|
+
// no uvs yet
|
|
2821
|
+
|
|
2822
|
+
// "solid" influences the material so let's store it for later use
|
|
2823
|
+
|
|
2824
|
+
geometry._solid = solid;
|
|
2825
|
+
geometry._type = 'mesh';
|
|
2826
|
+
|
|
2827
|
+
return geometry;
|
|
2828
|
+
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
// helper functions
|
|
2832
|
+
|
|
2833
|
+
function resolveUSE( identifier ) {
|
|
2834
|
+
|
|
2835
|
+
const node = nodeMap[ identifier ];
|
|
2836
|
+
const build = getNode( node );
|
|
2837
|
+
|
|
2838
|
+
// because the same 3D objects can have different transformations, it's necessary to clone them.
|
|
2839
|
+
// materials can be influenced by the geometry (e.g. vertex normals). cloning is necessary to avoid
|
|
2840
|
+
// any side effects
|
|
2841
|
+
|
|
2842
|
+
return ( build.isObject3D || build.isMaterial ) ? build.clone() : build;
|
|
2843
|
+
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
function parseFieldChildren( children, owner ) {
|
|
2847
|
+
|
|
2848
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
2849
|
+
|
|
2850
|
+
const object = getNode( children[ i ] );
|
|
2851
|
+
|
|
2852
|
+
if ( object instanceof Object3D ) owner.add( object );
|
|
2853
|
+
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
function triangulateFaceIndex( index, ccw ) {
|
|
2859
|
+
|
|
2860
|
+
const indices = [];
|
|
2861
|
+
|
|
2862
|
+
// since face definitions can have more than three vertices, it's necessary to
|
|
2863
|
+
// perform a simple triangulation
|
|
2864
|
+
|
|
2865
|
+
let start = 0;
|
|
2866
|
+
|
|
2867
|
+
for ( let i = 0, l = index.length; i < l; i ++ ) {
|
|
2868
|
+
|
|
2869
|
+
const i1 = index[ start ];
|
|
2870
|
+
const i2 = index[ i + ( ccw ? 1 : 2 ) ];
|
|
2871
|
+
const i3 = index[ i + ( ccw ? 2 : 1 ) ];
|
|
2872
|
+
|
|
2873
|
+
indices.push( i1, i2, i3 );
|
|
2874
|
+
|
|
2875
|
+
// an index of -1 indicates that the current face has ended and the next one begins
|
|
2876
|
+
|
|
2877
|
+
if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
|
|
2878
|
+
|
|
2879
|
+
i += 3;
|
|
2880
|
+
start = i + 1;
|
|
2881
|
+
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
return indices;
|
|
2887
|
+
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
function triangulateFaceData( data, index ) {
|
|
2891
|
+
|
|
2892
|
+
const triangulatedData = [];
|
|
2893
|
+
|
|
2894
|
+
let start = 0;
|
|
2895
|
+
|
|
2896
|
+
for ( let i = 0, l = index.length; i < l; i ++ ) {
|
|
2897
|
+
|
|
2898
|
+
const stride = start * 3;
|
|
2899
|
+
|
|
2900
|
+
const x = data[ stride ];
|
|
2901
|
+
const y = data[ stride + 1 ];
|
|
2902
|
+
const z = data[ stride + 2 ];
|
|
2903
|
+
|
|
2904
|
+
triangulatedData.push( x, y, z );
|
|
2905
|
+
|
|
2906
|
+
// an index of -1 indicates that the current face has ended and the next one begins
|
|
2907
|
+
|
|
2908
|
+
if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
|
|
2909
|
+
|
|
2910
|
+
i += 3;
|
|
2911
|
+
start ++;
|
|
2912
|
+
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
return triangulatedData;
|
|
2918
|
+
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
function flattenData( data, index ) {
|
|
2922
|
+
|
|
2923
|
+
const flattenData = [];
|
|
2924
|
+
|
|
2925
|
+
for ( let i = 0, l = index.length; i < l; i ++ ) {
|
|
2926
|
+
|
|
2927
|
+
const i1 = index[ i ];
|
|
2928
|
+
|
|
2929
|
+
const stride = i1 * 3;
|
|
2930
|
+
|
|
2931
|
+
const x = data[ stride ];
|
|
2932
|
+
const y = data[ stride + 1 ];
|
|
2933
|
+
const z = data[ stride + 2 ];
|
|
2934
|
+
|
|
2935
|
+
flattenData.push( x, y, z );
|
|
2936
|
+
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
return flattenData;
|
|
2940
|
+
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
function expandLineIndex( index ) {
|
|
2944
|
+
|
|
2945
|
+
const indices = [];
|
|
2946
|
+
|
|
2947
|
+
for ( let i = 0, l = index.length; i < l; i ++ ) {
|
|
2948
|
+
|
|
2949
|
+
const i1 = index[ i ];
|
|
2950
|
+
const i2 = index[ i + 1 ];
|
|
2951
|
+
|
|
2952
|
+
indices.push( i1, i2 );
|
|
2953
|
+
|
|
2954
|
+
// an index of -1 indicates that the current line has ended and the next one begins
|
|
2955
|
+
|
|
2956
|
+
if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
|
|
2957
|
+
|
|
2958
|
+
i += 2;
|
|
2959
|
+
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
return indices;
|
|
2965
|
+
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
function expandLineData( data, index ) {
|
|
2969
|
+
|
|
2970
|
+
const triangulatedData = [];
|
|
2971
|
+
|
|
2972
|
+
let start = 0;
|
|
2973
|
+
|
|
2974
|
+
for ( let i = 0, l = index.length; i < l; i ++ ) {
|
|
2975
|
+
|
|
2976
|
+
const stride = start * 3;
|
|
2977
|
+
|
|
2978
|
+
const x = data[ stride ];
|
|
2979
|
+
const y = data[ stride + 1 ];
|
|
2980
|
+
const z = data[ stride + 2 ];
|
|
2981
|
+
|
|
2982
|
+
triangulatedData.push( x, y, z );
|
|
2983
|
+
|
|
2984
|
+
// an index of -1 indicates that the current line has ended and the next one begins
|
|
2985
|
+
|
|
2986
|
+
if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
|
|
2987
|
+
|
|
2988
|
+
i += 2;
|
|
2989
|
+
start ++;
|
|
2990
|
+
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
return triangulatedData;
|
|
2996
|
+
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
const vA = new Vector3();
|
|
3000
|
+
const vB = new Vector3();
|
|
3001
|
+
const vC = new Vector3();
|
|
3002
|
+
|
|
3003
|
+
const uvA = new Vector2();
|
|
3004
|
+
const uvB = new Vector2();
|
|
3005
|
+
const uvC = new Vector2();
|
|
3006
|
+
|
|
3007
|
+
function computeAttributeFromIndexedData( coordIndex, index, data, itemSize ) {
|
|
3008
|
+
|
|
3009
|
+
const array = [];
|
|
3010
|
+
|
|
3011
|
+
// we use the coordIndex.length as delimiter since normalIndex must contain at least as many indices
|
|
3012
|
+
|
|
3013
|
+
for ( let i = 0, l = coordIndex.length; i < l; i += 3 ) {
|
|
3014
|
+
|
|
3015
|
+
const a = index[ i ];
|
|
3016
|
+
const b = index[ i + 1 ];
|
|
3017
|
+
const c = index[ i + 2 ];
|
|
3018
|
+
|
|
3019
|
+
if ( itemSize === 2 ) {
|
|
3020
|
+
|
|
3021
|
+
uvA.fromArray( data, a * itemSize );
|
|
3022
|
+
uvB.fromArray( data, b * itemSize );
|
|
3023
|
+
uvC.fromArray( data, c * itemSize );
|
|
3024
|
+
|
|
3025
|
+
array.push( uvA.x, uvA.y );
|
|
3026
|
+
array.push( uvB.x, uvB.y );
|
|
3027
|
+
array.push( uvC.x, uvC.y );
|
|
3028
|
+
|
|
3029
|
+
} else {
|
|
3030
|
+
|
|
3031
|
+
vA.fromArray( data, a * itemSize );
|
|
3032
|
+
vB.fromArray( data, b * itemSize );
|
|
3033
|
+
vC.fromArray( data, c * itemSize );
|
|
3034
|
+
|
|
3035
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3036
|
+
array.push( vB.x, vB.y, vB.z );
|
|
3037
|
+
array.push( vC.x, vC.y, vC.z );
|
|
3038
|
+
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
return new Float32BufferAttribute( array, itemSize );
|
|
3044
|
+
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
function computeAttributeFromFaceData( index, faceData ) {
|
|
3048
|
+
|
|
3049
|
+
const array = [];
|
|
3050
|
+
|
|
3051
|
+
for ( let i = 0, j = 0, l = index.length; i < l; i += 3, j ++ ) {
|
|
3052
|
+
|
|
3053
|
+
vA.fromArray( faceData, j * 3 );
|
|
3054
|
+
|
|
3055
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3056
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3057
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3058
|
+
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
return new Float32BufferAttribute( array, 3 );
|
|
3062
|
+
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
function computeAttributeFromLineData( index, lineData ) {
|
|
3066
|
+
|
|
3067
|
+
const array = [];
|
|
3068
|
+
|
|
3069
|
+
for ( let i = 0, j = 0, l = index.length; i < l; i += 2, j ++ ) {
|
|
3070
|
+
|
|
3071
|
+
vA.fromArray( lineData, j * 3 );
|
|
3072
|
+
|
|
3073
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3074
|
+
array.push( vA.x, vA.y, vA.z );
|
|
3075
|
+
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
return new Float32BufferAttribute( array, 3 );
|
|
3079
|
+
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
function toNonIndexedAttribute( indices, attribute ) {
|
|
3083
|
+
|
|
3084
|
+
const array = attribute.array;
|
|
3085
|
+
const itemSize = attribute.itemSize;
|
|
3086
|
+
|
|
3087
|
+
const array2 = new array.constructor( indices.length * itemSize );
|
|
3088
|
+
|
|
3089
|
+
let index = 0, index2 = 0;
|
|
3090
|
+
|
|
3091
|
+
for ( let i = 0, l = indices.length; i < l; i ++ ) {
|
|
3092
|
+
|
|
3093
|
+
index = indices[ i ] * itemSize;
|
|
3094
|
+
|
|
3095
|
+
for ( let j = 0; j < itemSize; j ++ ) {
|
|
3096
|
+
|
|
3097
|
+
array2[ index2 ++ ] = array[ index ++ ];
|
|
3098
|
+
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
return new Float32BufferAttribute( array2, itemSize );
|
|
3104
|
+
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
const ab = new Vector3();
|
|
3108
|
+
const cb = new Vector3();
|
|
3109
|
+
|
|
3110
|
+
function computeNormalAttribute( index, coord, creaseAngle ) {
|
|
3111
|
+
|
|
3112
|
+
const faces = [];
|
|
3113
|
+
const vertexNormals = {};
|
|
3114
|
+
|
|
3115
|
+
// prepare face and raw vertex normals
|
|
3116
|
+
|
|
3117
|
+
for ( let i = 0, l = index.length; i < l; i += 3 ) {
|
|
3118
|
+
|
|
3119
|
+
const a = index[ i ];
|
|
3120
|
+
const b = index[ i + 1 ];
|
|
3121
|
+
const c = index[ i + 2 ];
|
|
3122
|
+
|
|
3123
|
+
const face = new Face( a, b, c );
|
|
3124
|
+
|
|
3125
|
+
vA.fromArray( coord, a * 3 );
|
|
3126
|
+
vB.fromArray( coord, b * 3 );
|
|
3127
|
+
vC.fromArray( coord, c * 3 );
|
|
3128
|
+
|
|
3129
|
+
cb.subVectors( vC, vB );
|
|
3130
|
+
ab.subVectors( vA, vB );
|
|
3131
|
+
cb.cross( ab );
|
|
3132
|
+
|
|
3133
|
+
cb.normalize();
|
|
3134
|
+
|
|
3135
|
+
face.normal.copy( cb );
|
|
3136
|
+
|
|
3137
|
+
if ( vertexNormals[ a ] === undefined ) vertexNormals[ a ] = [];
|
|
3138
|
+
if ( vertexNormals[ b ] === undefined ) vertexNormals[ b ] = [];
|
|
3139
|
+
if ( vertexNormals[ c ] === undefined ) vertexNormals[ c ] = [];
|
|
3140
|
+
|
|
3141
|
+
vertexNormals[ a ].push( face.normal );
|
|
3142
|
+
vertexNormals[ b ].push( face.normal );
|
|
3143
|
+
vertexNormals[ c ].push( face.normal );
|
|
3144
|
+
|
|
3145
|
+
faces.push( face );
|
|
3146
|
+
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
// compute vertex normals and build final geometry
|
|
3150
|
+
|
|
3151
|
+
const normals = [];
|
|
3152
|
+
|
|
3153
|
+
for ( let i = 0, l = faces.length; i < l; i ++ ) {
|
|
3154
|
+
|
|
3155
|
+
const face = faces[ i ];
|
|
3156
|
+
|
|
3157
|
+
const nA = weightedNormal( vertexNormals[ face.a ], face.normal, creaseAngle );
|
|
3158
|
+
const nB = weightedNormal( vertexNormals[ face.b ], face.normal, creaseAngle );
|
|
3159
|
+
const nC = weightedNormal( vertexNormals[ face.c ], face.normal, creaseAngle );
|
|
3160
|
+
|
|
3161
|
+
vA.fromArray( coord, face.a * 3 );
|
|
3162
|
+
vB.fromArray( coord, face.b * 3 );
|
|
3163
|
+
vC.fromArray( coord, face.c * 3 );
|
|
3164
|
+
|
|
3165
|
+
normals.push( nA.x, nA.y, nA.z );
|
|
3166
|
+
normals.push( nB.x, nB.y, nB.z );
|
|
3167
|
+
normals.push( nC.x, nC.y, nC.z );
|
|
3168
|
+
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
return new Float32BufferAttribute( normals, 3 );
|
|
3172
|
+
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
function weightedNormal( normals, vector, creaseAngle ) {
|
|
3176
|
+
|
|
3177
|
+
const normal = new Vector3();
|
|
3178
|
+
|
|
3179
|
+
if ( creaseAngle === 0 ) {
|
|
3180
|
+
|
|
3181
|
+
normal.copy( vector );
|
|
3182
|
+
|
|
3183
|
+
} else {
|
|
3184
|
+
|
|
3185
|
+
for ( let i = 0, l = normals.length; i < l; i ++ ) {
|
|
3186
|
+
|
|
3187
|
+
if ( normals[ i ].angleTo( vector ) < creaseAngle ) {
|
|
3188
|
+
|
|
3189
|
+
normal.add( normals[ i ] );
|
|
3190
|
+
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
return normal.normalize();
|
|
3198
|
+
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
function toColorArray( colors ) {
|
|
3202
|
+
|
|
3203
|
+
const array = [];
|
|
3204
|
+
|
|
3205
|
+
for ( let i = 0, l = colors.length; i < l; i += 3 ) {
|
|
3206
|
+
|
|
3207
|
+
array.push( new Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) );
|
|
3208
|
+
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
return array;
|
|
3212
|
+
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
function convertColorsToLinearSRGB( attribute ) {
|
|
3216
|
+
|
|
3217
|
+
const color = new Color();
|
|
3218
|
+
|
|
3219
|
+
for ( let i = 0; i < attribute.count; i ++ ) {
|
|
3220
|
+
|
|
3221
|
+
color.fromBufferAttribute( attribute, i );
|
|
3222
|
+
|
|
3223
|
+
ColorManagement.colorSpaceToWorking( color, SRGBColorSpace );
|
|
3224
|
+
|
|
3225
|
+
attribute.setXYZ( i, color.r, color.g, color.b );
|
|
3226
|
+
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
/**
|
|
3232
|
+
* Vertically paints the faces interpolating between the
|
|
3233
|
+
* specified colors at the specified angels. This is used for the Background
|
|
3234
|
+
* node, but could be applied to other nodes with multiple faces as well.
|
|
3235
|
+
*
|
|
3236
|
+
* When used with the Background node, default is directionIsDown is true if
|
|
3237
|
+
* interpolating the skyColor down from the Zenith. When interpolating up from
|
|
3238
|
+
* the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
|
|
3239
|
+
*
|
|
3240
|
+
* The first angle is never specified, it is the Zenith (0 rad). Angles are specified
|
|
3241
|
+
* in radians. The geometry is thought a sphere, but could be anything. The color interpolation
|
|
3242
|
+
* is linear along the Y axis in any case.
|
|
3243
|
+
*
|
|
3244
|
+
* You must specify one more color than you have angles at the beginning of the colors array.
|
|
3245
|
+
* This is the color of the Zenith (the top of the shape).
|
|
3246
|
+
*
|
|
3247
|
+
* @param {BufferGeometry} geometry
|
|
3248
|
+
* @param {number} radius
|
|
3249
|
+
* @param {Array} angles
|
|
3250
|
+
* @param {Array} colors
|
|
3251
|
+
* @param {boolean} topDown - Whether to work top down or bottom up.
|
|
3252
|
+
*/
|
|
3253
|
+
function paintFaces( geometry, radius, angles, colors, topDown ) {
|
|
3254
|
+
|
|
3255
|
+
// compute threshold values
|
|
3256
|
+
|
|
3257
|
+
const thresholds = [];
|
|
3258
|
+
const startAngle = ( topDown === true ) ? 0 : Math.PI;
|
|
3259
|
+
|
|
3260
|
+
for ( let i = 0, l = colors.length; i < l; i ++ ) {
|
|
3261
|
+
|
|
3262
|
+
let angle = ( i === 0 ) ? 0 : angles[ i - 1 ];
|
|
3263
|
+
angle = ( topDown === true ) ? angle : ( startAngle - angle );
|
|
3264
|
+
|
|
3265
|
+
const point = new Vector3();
|
|
3266
|
+
point.setFromSphericalCoords( radius, angle, 0 );
|
|
3267
|
+
|
|
3268
|
+
thresholds.push( point );
|
|
3269
|
+
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
// generate vertex colors
|
|
3273
|
+
|
|
3274
|
+
const indices = geometry.index;
|
|
3275
|
+
const positionAttribute = geometry.attributes.position;
|
|
3276
|
+
const colorAttribute = new BufferAttribute( new Float32Array( geometry.attributes.position.count * 3 ), 3 );
|
|
3277
|
+
|
|
3278
|
+
const position = new Vector3();
|
|
3279
|
+
const color = new Color();
|
|
3280
|
+
|
|
3281
|
+
for ( let i = 0; i < indices.count; i ++ ) {
|
|
3282
|
+
|
|
3283
|
+
const index = indices.getX( i );
|
|
3284
|
+
position.fromBufferAttribute( positionAttribute, index );
|
|
3285
|
+
|
|
3286
|
+
let thresholdIndexA, thresholdIndexB;
|
|
3287
|
+
let t = 1;
|
|
3288
|
+
|
|
3289
|
+
for ( let j = 1; j < thresholds.length; j ++ ) {
|
|
3290
|
+
|
|
3291
|
+
thresholdIndexA = j - 1;
|
|
3292
|
+
thresholdIndexB = j;
|
|
3293
|
+
|
|
3294
|
+
const thresholdA = thresholds[ thresholdIndexA ];
|
|
3295
|
+
const thresholdB = thresholds[ thresholdIndexB ];
|
|
3296
|
+
|
|
3297
|
+
if ( topDown === true ) {
|
|
3298
|
+
|
|
3299
|
+
// interpolation for sky color
|
|
3300
|
+
|
|
3301
|
+
if ( position.y <= thresholdA.y && position.y > thresholdB.y ) {
|
|
3302
|
+
|
|
3303
|
+
t = Math.abs( thresholdA.y - position.y ) / Math.abs( thresholdA.y - thresholdB.y );
|
|
3304
|
+
|
|
3305
|
+
break;
|
|
3306
|
+
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
} else {
|
|
3310
|
+
|
|
3311
|
+
// interpolation for ground color
|
|
3312
|
+
|
|
3313
|
+
if ( position.y >= thresholdA.y && position.y < thresholdB.y ) {
|
|
3314
|
+
|
|
3315
|
+
t = Math.abs( thresholdA.y - position.y ) / Math.abs( thresholdA.y - thresholdB.y );
|
|
3316
|
+
|
|
3317
|
+
break;
|
|
3318
|
+
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
const colorA = colors[ thresholdIndexA ];
|
|
3326
|
+
const colorB = colors[ thresholdIndexB ];
|
|
3327
|
+
|
|
3328
|
+
color.copy( colorA ).lerp( colorB, t );
|
|
3329
|
+
|
|
3330
|
+
ColorManagement.colorSpaceToWorking( color, SRGBColorSpace );
|
|
3331
|
+
|
|
3332
|
+
colorAttribute.setXYZ( index, color.r, color.g, color.b );
|
|
3333
|
+
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
geometry.setAttribute( 'color', colorAttribute );
|
|
3337
|
+
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
//
|
|
3341
|
+
|
|
3342
|
+
const textureLoader = new TextureLoader( this.manager );
|
|
3343
|
+
textureLoader.setPriority( this.priority );
|
|
3344
|
+
textureLoader.setCache( this.cache );
|
|
3345
|
+
textureLoader.setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
|
|
3346
|
+
|
|
3347
|
+
// check version (only 2.0 is supported)
|
|
3348
|
+
|
|
3349
|
+
if ( data.indexOf( '#VRML V2.0' ) === - 1 ) {
|
|
3350
|
+
|
|
3351
|
+
throw Error( 'THREE.VRMLLexer: Version of VRML asset not supported.' );
|
|
3352
|
+
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// create JSON representing the tree structure of the VRML asset
|
|
3356
|
+
|
|
3357
|
+
const tree = generateVRMLTree( data );
|
|
3358
|
+
|
|
3359
|
+
// parse the tree structure to a three.js scene
|
|
3360
|
+
|
|
3361
|
+
const scene = parseTree( tree );
|
|
3362
|
+
|
|
3363
|
+
return scene;
|
|
3364
|
+
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
class VRMLLexer {
|
|
3370
|
+
|
|
3371
|
+
constructor( tokens ) {
|
|
3372
|
+
|
|
3373
|
+
this.lexer = new chevrotain.Lexer( tokens );
|
|
3374
|
+
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
lex( inputText ) {
|
|
3378
|
+
|
|
3379
|
+
const lexingResult = this.lexer.tokenize( inputText );
|
|
3380
|
+
|
|
3381
|
+
if ( lexingResult.errors.length > 0 ) {
|
|
3382
|
+
|
|
3383
|
+
console.error( lexingResult.errors );
|
|
3384
|
+
|
|
3385
|
+
throw Error( 'THREE.VRMLLexer: Lexing errors detected.' );
|
|
3386
|
+
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
return lexingResult;
|
|
3390
|
+
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3395
|
+
const CstParser = chevrotain.CstParser;
|
|
3396
|
+
|
|
3397
|
+
class VRMLParser extends CstParser {
|
|
3398
|
+
|
|
3399
|
+
constructor( tokenVocabulary ) {
|
|
3400
|
+
|
|
3401
|
+
super( tokenVocabulary );
|
|
3402
|
+
|
|
3403
|
+
const $ = this;
|
|
3404
|
+
|
|
3405
|
+
const Version = tokenVocabulary[ 'Version' ];
|
|
3406
|
+
const LCurly = tokenVocabulary[ 'LCurly' ];
|
|
3407
|
+
const RCurly = tokenVocabulary[ 'RCurly' ];
|
|
3408
|
+
const LSquare = tokenVocabulary[ 'LSquare' ];
|
|
3409
|
+
const RSquare = tokenVocabulary[ 'RSquare' ];
|
|
3410
|
+
const Identifier = tokenVocabulary[ 'Identifier' ];
|
|
3411
|
+
const RouteIdentifier = tokenVocabulary[ 'RouteIdentifier' ];
|
|
3412
|
+
const StringLiteral = tokenVocabulary[ 'StringLiteral' ];
|
|
3413
|
+
const HexLiteral = tokenVocabulary[ 'HexLiteral' ];
|
|
3414
|
+
const NumberLiteral = tokenVocabulary[ 'NumberLiteral' ];
|
|
3415
|
+
const TrueLiteral = tokenVocabulary[ 'TrueLiteral' ];
|
|
3416
|
+
const FalseLiteral = tokenVocabulary[ 'FalseLiteral' ];
|
|
3417
|
+
const NullLiteral = tokenVocabulary[ 'NullLiteral' ];
|
|
3418
|
+
const DEF = tokenVocabulary[ 'DEF' ];
|
|
3419
|
+
const USE = tokenVocabulary[ 'USE' ];
|
|
3420
|
+
const ROUTE = tokenVocabulary[ 'ROUTE' ];
|
|
3421
|
+
const TO = tokenVocabulary[ 'TO' ];
|
|
3422
|
+
const NodeName = tokenVocabulary[ 'NodeName' ];
|
|
3423
|
+
|
|
3424
|
+
$.RULE( 'vrml', function () {
|
|
3425
|
+
|
|
3426
|
+
$.SUBRULE( $.version );
|
|
3427
|
+
$.AT_LEAST_ONE( function () {
|
|
3428
|
+
|
|
3429
|
+
$.SUBRULE( $.node );
|
|
3430
|
+
|
|
3431
|
+
} );
|
|
3432
|
+
$.MANY( function () {
|
|
3433
|
+
|
|
3434
|
+
$.SUBRULE( $.route );
|
|
3435
|
+
|
|
3436
|
+
} );
|
|
3437
|
+
|
|
3438
|
+
} );
|
|
3439
|
+
|
|
3440
|
+
$.RULE( 'version', function () {
|
|
3441
|
+
|
|
3442
|
+
$.CONSUME( Version );
|
|
3443
|
+
|
|
3444
|
+
} );
|
|
3445
|
+
|
|
3446
|
+
$.RULE( 'node', function () {
|
|
3447
|
+
|
|
3448
|
+
$.OPTION( function () {
|
|
3449
|
+
|
|
3450
|
+
$.SUBRULE( $.def );
|
|
3451
|
+
|
|
3452
|
+
} );
|
|
3453
|
+
|
|
3454
|
+
$.CONSUME( NodeName );
|
|
3455
|
+
$.CONSUME( LCurly );
|
|
3456
|
+
$.MANY( function () {
|
|
3457
|
+
|
|
3458
|
+
$.SUBRULE( $.field );
|
|
3459
|
+
|
|
3460
|
+
} );
|
|
3461
|
+
$.CONSUME( RCurly );
|
|
3462
|
+
|
|
3463
|
+
} );
|
|
3464
|
+
|
|
3465
|
+
$.RULE( 'field', function () {
|
|
3466
|
+
|
|
3467
|
+
$.CONSUME( Identifier );
|
|
3468
|
+
|
|
3469
|
+
$.OR2( [
|
|
3470
|
+
{ ALT: function () {
|
|
3471
|
+
|
|
3472
|
+
$.SUBRULE( $.singleFieldValue );
|
|
3473
|
+
|
|
3474
|
+
} },
|
|
3475
|
+
{ ALT: function () {
|
|
3476
|
+
|
|
3477
|
+
$.SUBRULE( $.multiFieldValue );
|
|
3478
|
+
|
|
3479
|
+
} }
|
|
3480
|
+
] );
|
|
3481
|
+
|
|
3482
|
+
} );
|
|
3483
|
+
|
|
3484
|
+
$.RULE( 'def', function () {
|
|
3485
|
+
|
|
3486
|
+
$.CONSUME( DEF );
|
|
3487
|
+
$.OR( [
|
|
3488
|
+
{ ALT: function () {
|
|
3489
|
+
|
|
3490
|
+
$.CONSUME( Identifier );
|
|
3491
|
+
|
|
3492
|
+
} },
|
|
3493
|
+
{ ALT: function () {
|
|
3494
|
+
|
|
3495
|
+
$.CONSUME( NodeName );
|
|
3496
|
+
|
|
3497
|
+
} }
|
|
3498
|
+
] );
|
|
3499
|
+
|
|
3500
|
+
} );
|
|
3501
|
+
|
|
3502
|
+
$.RULE( 'use', function () {
|
|
3503
|
+
|
|
3504
|
+
$.CONSUME( USE );
|
|
3505
|
+
$.OR( [
|
|
3506
|
+
{ ALT: function () {
|
|
3507
|
+
|
|
3508
|
+
$.CONSUME( Identifier );
|
|
3509
|
+
|
|
3510
|
+
} },
|
|
3511
|
+
{ ALT: function () {
|
|
3512
|
+
|
|
3513
|
+
$.CONSUME( NodeName );
|
|
3514
|
+
|
|
3515
|
+
} }
|
|
3516
|
+
] );
|
|
3517
|
+
|
|
3518
|
+
} );
|
|
3519
|
+
|
|
3520
|
+
$.RULE( 'singleFieldValue', function () {
|
|
3521
|
+
|
|
3522
|
+
$.AT_LEAST_ONE( function () {
|
|
3523
|
+
|
|
3524
|
+
$.OR( [
|
|
3525
|
+
{ ALT: function () {
|
|
3526
|
+
|
|
3527
|
+
$.SUBRULE( $.node );
|
|
3528
|
+
|
|
3529
|
+
} },
|
|
3530
|
+
{ ALT: function () {
|
|
3531
|
+
|
|
3532
|
+
$.SUBRULE( $.use );
|
|
3533
|
+
|
|
3534
|
+
} },
|
|
3535
|
+
{ ALT: function () {
|
|
3536
|
+
|
|
3537
|
+
$.CONSUME( StringLiteral );
|
|
3538
|
+
|
|
3539
|
+
} },
|
|
3540
|
+
{ ALT: function () {
|
|
3541
|
+
|
|
3542
|
+
$.CONSUME( HexLiteral );
|
|
3543
|
+
|
|
3544
|
+
} },
|
|
3545
|
+
{ ALT: function () {
|
|
3546
|
+
|
|
3547
|
+
$.CONSUME( NumberLiteral );
|
|
3548
|
+
|
|
3549
|
+
} },
|
|
3550
|
+
{ ALT: function () {
|
|
3551
|
+
|
|
3552
|
+
$.CONSUME( TrueLiteral );
|
|
3553
|
+
|
|
3554
|
+
} },
|
|
3555
|
+
{ ALT: function () {
|
|
3556
|
+
|
|
3557
|
+
$.CONSUME( FalseLiteral );
|
|
3558
|
+
|
|
3559
|
+
} },
|
|
3560
|
+
{ ALT: function () {
|
|
3561
|
+
|
|
3562
|
+
$.CONSUME( NullLiteral );
|
|
3563
|
+
|
|
3564
|
+
} }
|
|
3565
|
+
] );
|
|
3566
|
+
|
|
3567
|
+
|
|
3568
|
+
} );
|
|
3569
|
+
|
|
3570
|
+
} );
|
|
3571
|
+
|
|
3572
|
+
$.RULE( 'multiFieldValue', function () {
|
|
3573
|
+
|
|
3574
|
+
$.CONSUME( LSquare );
|
|
3575
|
+
$.MANY( function () {
|
|
3576
|
+
|
|
3577
|
+
$.OR( [
|
|
3578
|
+
{ ALT: function () {
|
|
3579
|
+
|
|
3580
|
+
$.SUBRULE( $.node );
|
|
3581
|
+
|
|
3582
|
+
} },
|
|
3583
|
+
{ ALT: function () {
|
|
3584
|
+
|
|
3585
|
+
$.SUBRULE( $.use );
|
|
3586
|
+
|
|
3587
|
+
} },
|
|
3588
|
+
{ ALT: function () {
|
|
3589
|
+
|
|
3590
|
+
$.CONSUME( StringLiteral );
|
|
3591
|
+
|
|
3592
|
+
} },
|
|
3593
|
+
{ ALT: function () {
|
|
3594
|
+
|
|
3595
|
+
$.CONSUME( HexLiteral );
|
|
3596
|
+
|
|
3597
|
+
} },
|
|
3598
|
+
{ ALT: function () {
|
|
3599
|
+
|
|
3600
|
+
$.CONSUME( NumberLiteral );
|
|
3601
|
+
|
|
3602
|
+
} },
|
|
3603
|
+
{ ALT: function () {
|
|
3604
|
+
|
|
3605
|
+
$.CONSUME( NullLiteral );
|
|
3606
|
+
|
|
3607
|
+
} }
|
|
3608
|
+
] );
|
|
3609
|
+
|
|
3610
|
+
} );
|
|
3611
|
+
$.CONSUME( RSquare );
|
|
3612
|
+
|
|
3613
|
+
} );
|
|
3614
|
+
|
|
3615
|
+
$.RULE( 'route', function () {
|
|
3616
|
+
|
|
3617
|
+
$.CONSUME( ROUTE );
|
|
3618
|
+
$.CONSUME( RouteIdentifier );
|
|
3619
|
+
$.CONSUME( TO );
|
|
3620
|
+
$.CONSUME2( RouteIdentifier );
|
|
3621
|
+
|
|
3622
|
+
} );
|
|
3623
|
+
|
|
3624
|
+
this.performSelfAnalysis();
|
|
3625
|
+
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
class Face {
|
|
3631
|
+
|
|
3632
|
+
constructor( a, b, c ) {
|
|
3633
|
+
|
|
3634
|
+
this.a = a;
|
|
3635
|
+
this.b = b;
|
|
3636
|
+
this.c = c;
|
|
3637
|
+
this.normal = new Vector3();
|
|
3638
|
+
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
const TEXTURE_TYPE = {
|
|
3644
|
+
INTENSITY: 1,
|
|
3645
|
+
INTENSITY_ALPHA: 2,
|
|
3646
|
+
RGB: 3,
|
|
3647
|
+
RGBA: 4
|
|
3648
|
+
};
|
|
3649
|
+
|
|
3650
|
+
export { VRMLLoader };
|