vc-spaces365-threejs 0.180.0

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