opal-js_wrap-three 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +4 -4
  4. data/lib/opal/js_wrap/three/version.rb +1 -1
  5. data/lib-opal/js_wrap/three/WebGL.js +102 -0
  6. data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
  7. data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
  8. data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
  9. data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
  10. data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
  11. data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
  12. data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
  13. data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
  14. data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
  15. data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
  16. data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
  17. data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
  18. data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
  19. data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
  20. data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
  21. data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
  22. data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
  23. data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
  24. data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
  25. data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
  26. data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
  27. data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
  28. data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
  29. data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
  30. data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
  31. data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
  32. data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
  33. data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
  34. data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
  35. data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
  36. data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
  37. data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
  38. data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
  39. data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
  40. data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
  41. data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
  42. data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
  43. data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
  44. data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
  45. data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
  46. data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
  47. data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
  48. data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
  49. data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
  50. data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
  51. data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
  52. data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
  53. data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
  54. data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
  55. data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
  56. data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
  57. data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
  58. data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
  59. data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
  60. data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
  61. data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
  62. data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
  63. data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
  64. data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
  65. data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
  66. data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
  67. data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
  68. data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
  69. data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
  70. data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
  71. data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
  72. data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
  73. data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
  74. data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
  75. data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
  76. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
  77. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
  78. data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
  79. data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
  80. data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
  81. data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
  82. data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
  83. data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
  84. data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
  85. data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
  86. data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
  87. data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
  88. data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
  89. data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
  90. data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
  91. data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
  92. data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
  93. data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
  94. data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
  95. data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
  96. data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
  97. data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
  98. data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
  99. data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
  100. data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
  101. data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
  102. data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
  103. data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
  104. data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
  105. data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
  106. data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
  107. data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
  108. data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
  109. data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
  110. data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
  111. data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
  112. data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
  113. data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
  114. data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
  115. data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
  116. data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
  117. data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
  118. data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
  119. data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
  120. data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
  121. data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
  122. data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
  123. data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
  124. data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
  125. data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
  126. data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
  127. data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
  128. data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
  129. data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
  130. data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
  131. data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
  132. data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
  133. data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
  134. data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
  135. data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
  136. data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
  137. data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
  138. data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
  139. data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
  140. data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
  141. data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
  142. data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
  143. data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
  144. data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
  145. data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
  146. data/lib-opal/js_wrap/three/math/Lut.js +170 -0
  147. data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
  148. data/lib-opal/js_wrap/three/math/OBB.js +345 -0
  149. data/lib-opal/js_wrap/three/math/Octree.js +409 -0
  150. data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
  151. data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
  152. data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
  153. data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
  154. data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
  155. data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
  156. data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
  157. data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
  158. data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
  159. data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
  160. data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
  161. data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
  162. data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
  163. data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
  164. data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
  165. data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
  166. data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
  167. data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
  168. data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
  169. data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
  170. data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
  171. data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
  172. data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
  173. data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
  174. data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
  175. data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
  176. data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
  177. data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
  178. data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
  179. data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
  180. data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
  181. data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
  182. data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
  183. data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
  184. data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
  185. data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
  186. data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
  187. data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
  188. data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
  189. data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
  190. data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
  191. data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
  192. data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
  193. data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
  194. data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
  195. data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
  196. data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
  197. data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
  198. data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
  199. data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
  200. data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
  201. data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
  202. data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
  203. data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
  204. data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
  205. data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
  206. data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
  207. data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
  208. data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
  209. data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
  210. data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
  211. data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
  212. data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
  213. data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
  214. data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
  215. data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
  216. data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
  217. data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
  218. data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
  219. data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
  220. data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
  221. data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
  222. data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
  223. data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
  224. data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
  225. data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
  226. data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
  227. data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
  228. data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
  229. data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
  230. data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
  231. data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
  232. data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
  233. data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
  234. data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
  235. data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
  236. data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
  237. data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
  238. data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
  239. data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
  240. data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
  241. data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
  242. data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
  243. data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
  244. data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
  245. data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
  246. data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
  247. data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
  248. data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
  249. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
  250. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
  251. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
  252. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
  253. data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
  254. data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
  255. data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
  256. data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
  257. data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
  258. data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
  259. data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
  260. data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
  261. data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
  262. data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
  263. data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
  264. data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
  265. data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
  266. data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
  267. data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
  268. data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
  269. data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
  270. data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
  271. data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
  272. data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
  273. data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
  274. data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
  275. data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
  276. data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
  277. data/lib-opal/js_wrap/three/objects/Water.js +246 -0
  278. data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
  279. data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
  280. data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
  281. data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
  282. data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
  283. data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
  284. data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
  285. data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
  286. data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
  287. data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
  288. data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
  289. data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
  290. data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
  291. data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
  292. data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
  293. data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
  294. data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
  295. data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
  296. data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
  297. data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
  298. data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
  299. data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
  300. data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
  301. data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
  302. data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
  303. data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
  304. data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
  305. data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
  306. data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
  307. data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
  308. data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
  309. data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
  310. data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
  311. data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
  312. data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
  313. data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
  314. data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
  315. data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
  316. data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
  317. data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
  318. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
  319. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
  320. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
  321. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
  322. data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
  323. data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
  324. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
  325. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
  326. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
  327. data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
  328. data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
  329. data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
  330. data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
  331. data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
  332. data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
  333. data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
  334. data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
  335. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
  336. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
  337. data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
  338. data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
  339. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
  340. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
  341. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
  342. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
  343. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
  344. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
  345. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
  346. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
  347. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
  348. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
  349. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
  350. data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
  351. data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
  352. data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
  353. data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
  354. data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
  355. data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
  356. data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
  357. data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
  358. data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
  359. data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
  360. data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
  361. data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
  362. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
  363. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
  364. data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
  365. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
  366. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
  367. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
  368. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
  369. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
  370. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
  371. data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
  372. data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
  373. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
  374. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
  375. data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
  376. data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
  377. data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
  378. data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
  379. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
  380. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
  381. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
  382. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
  383. data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
  384. data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
  385. data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
  386. data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
  387. data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
  388. data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
  389. data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
  390. data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
  391. data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
  392. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
  393. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
  394. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
  395. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
  396. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
  397. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
  398. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
  399. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
  400. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
  401. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
  402. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
  403. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
  404. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
  405. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
  406. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
  407. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
  408. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
  409. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
  410. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
  411. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
  412. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
  413. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
  414. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
  415. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
  416. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
  417. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
  418. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
  419. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
  420. data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
  421. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
  422. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
  423. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
  424. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
  425. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
  426. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
  427. data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
  428. data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
  429. data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
  430. data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
  431. data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
  432. data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
  433. data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
  434. data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
  435. data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
  436. data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
  437. data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
  438. data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
  439. data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
  440. data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
  441. data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
  442. data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
  443. data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
  444. data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
  445. data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
  446. data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
  447. data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
  448. data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
  449. data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
  450. data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
  451. data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
  452. data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
  453. data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
  454. data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
  455. data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
  456. data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
  457. data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
  458. data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
  459. data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
  460. data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
  461. data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
  462. data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
  463. data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
  464. data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
  465. data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
  466. data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
  467. data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
  468. data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
  469. data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
  470. data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
  471. data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
  472. data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
  473. data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
  474. data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
  475. data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
  476. data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
  477. data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
  478. data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
  479. data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
  480. data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
  481. data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
  482. data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
  483. data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
  484. data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
  485. data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
  486. data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
  487. data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
  488. data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
  489. data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
  490. data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
  491. data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
  492. data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
  493. data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
  494. data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
  495. data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
  496. data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
  497. data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
  498. data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
  499. data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
  500. data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
  501. data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
  502. data/opal-js_wrap-three.gemspec +4 -4
  503. metadata +502 -5
@@ -0,0 +1,2685 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "three", "../libs/chevrotain.module.min.js"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("three"), require("../libs/chevrotain.module.min.js"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.three, global.chevrotainModuleMin);
11
+ global.VRMLLoader = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, _chevrotainModuleMin) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.VRMLLoader = void 0;
20
+ _chevrotainModuleMin = _interopRequireDefault(_chevrotainModuleMin);
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+
26
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
+
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
+
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
+
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
+
36
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
37
+
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+
44
+ var VRMLLoader = /*#__PURE__*/function (_Loader) {
45
+ _inherits(VRMLLoader, _Loader);
46
+
47
+ var _super = _createSuper(VRMLLoader);
48
+
49
+ function VRMLLoader(manager) {
50
+ var _this;
51
+
52
+ _classCallCheck(this, VRMLLoader);
53
+
54
+ _this = _super.call(this, manager); // dependency check
55
+
56
+ if (typeof _chevrotainModuleMin.default === 'undefined') {
57
+ // eslint-disable-line no-undef
58
+ throw Error('THREE.VRMLLoader: External library chevrotain.min.js required.');
59
+ }
60
+
61
+ return _this;
62
+ }
63
+
64
+ _createClass(VRMLLoader, [{
65
+ key: "load",
66
+ value: function load(url, onLoad, onProgress, onError) {
67
+ var scope = this;
68
+ var path = scope.path === '' ? _three.LoaderUtils.extractUrlBase(url) : scope.path;
69
+ var loader = new _three.FileLoader(scope.manager);
70
+ loader.setPath(scope.path);
71
+ loader.setRequestHeader(scope.requestHeader);
72
+ loader.setWithCredentials(scope.withCredentials);
73
+ loader.load(url, function (text) {
74
+ try {
75
+ onLoad(scope.parse(text, path));
76
+ } catch (e) {
77
+ if (onError) {
78
+ onError(e);
79
+ } else {
80
+ console.error(e);
81
+ }
82
+
83
+ scope.manager.itemError(url);
84
+ }
85
+ }, onProgress, onError);
86
+ }
87
+ }, {
88
+ key: "parse",
89
+ value: function parse(data, path) {
90
+ var nodeMap = {};
91
+
92
+ function generateVRMLTree(data) {
93
+ // create lexer, parser and visitor
94
+ var tokenData = createTokens();
95
+ var lexer = new VRMLLexer(tokenData.tokens);
96
+ var parser = new VRMLParser(tokenData.tokenVocabulary);
97
+ var visitor = createVisitor(parser.getBaseCstVisitorConstructor()); // lexing
98
+
99
+ var lexingResult = lexer.lex(data);
100
+ parser.input = lexingResult.tokens; // parsing
101
+
102
+ var cstOutput = parser.vrml();
103
+
104
+ if (parser.errors.length > 0) {
105
+ console.error(parser.errors);
106
+ throw Error('THREE.VRMLLoader: Parsing errors detected.');
107
+ } // actions
108
+
109
+
110
+ var ast = visitor.visit(cstOutput);
111
+ return ast;
112
+ }
113
+
114
+ function createTokens() {
115
+ var createToken = _chevrotainModuleMin.default.createToken; // eslint-disable-line no-undef
116
+ // from http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics
117
+
118
+ var RouteIdentifier = createToken({
119
+ name: 'RouteIdentifier',
120
+ 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]*/
121
+ });
122
+ var Identifier = createToken({
123
+ name: 'Identifier',
124
+ 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]*/,
125
+ longer_alt: RouteIdentifier
126
+ }); // from http://gun.teipir.gr/VRML-amgem/spec/part1/nodesRef.html
127
+
128
+ var nodeTypes = ['Anchor', 'Billboard', 'Collision', 'Group', 'Transform', // grouping nodes
129
+ 'Inline', 'LOD', 'Switch', // special groups
130
+ 'AudioClip', 'DirectionalLight', 'PointLight', 'Script', 'Shape', 'Sound', 'SpotLight', 'WorldInfo', // common nodes
131
+ 'CylinderSensor', 'PlaneSensor', 'ProximitySensor', 'SphereSensor', 'TimeSensor', 'TouchSensor', 'VisibilitySensor', // sensors
132
+ 'Box', 'Cone', 'Cylinder', 'ElevationGrid', 'Extrusion', 'IndexedFaceSet', 'IndexedLineSet', 'PointSet', 'Sphere', // geometries
133
+ 'Color', 'Coordinate', 'Normal', 'TextureCoordinate', // geometric properties
134
+ 'Appearance', 'FontStyle', 'ImageTexture', 'Material', 'MovieTexture', 'PixelTexture', 'TextureTransform', // appearance
135
+ 'ColorInterpolator', 'CoordinateInterpolator', 'NormalInterpolator', 'OrientationInterpolator', 'PositionInterpolator', 'ScalarInterpolator', // interpolators
136
+ 'Background', 'Fog', 'NavigationInfo', 'Viewpoint', // bindable nodes
137
+ 'Text' // Text must be placed at the end of the regex so there are no matches for TextureTransform and TextureCoordinate
138
+ ]; //
139
+
140
+ var Version = createToken({
141
+ name: 'Version',
142
+ pattern: /#VRML.*/,
143
+ longer_alt: Identifier
144
+ });
145
+ var NodeName = createToken({
146
+ name: 'NodeName',
147
+ pattern: new RegExp(nodeTypes.join('|')),
148
+ longer_alt: Identifier
149
+ });
150
+ var DEF = createToken({
151
+ name: 'DEF',
152
+ pattern: /DEF/,
153
+ longer_alt: Identifier
154
+ });
155
+ var USE = createToken({
156
+ name: 'USE',
157
+ pattern: /USE/,
158
+ longer_alt: Identifier
159
+ });
160
+ var ROUTE = createToken({
161
+ name: 'ROUTE',
162
+ pattern: /ROUTE/,
163
+ longer_alt: Identifier
164
+ });
165
+ var TO = createToken({
166
+ name: 'TO',
167
+ pattern: /TO/,
168
+ longer_alt: Identifier
169
+ }); //
170
+
171
+ var StringLiteral = createToken({
172
+ name: 'StringLiteral',
173
+ pattern: /"(:?[^\\"\n\r]+|\\(:?[bfnrtv"\\/]|u[0-9a-fA-F]{4}))*"/
174
+ });
175
+ var HexLiteral = createToken({
176
+ name: 'HexLiteral',
177
+ pattern: /0[xX][0-9a-fA-F]+/
178
+ });
179
+ var NumberLiteral = createToken({
180
+ name: 'NumberLiteral',
181
+ pattern: /[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/
182
+ });
183
+ var TrueLiteral = createToken({
184
+ name: 'TrueLiteral',
185
+ pattern: /TRUE/
186
+ });
187
+ var FalseLiteral = createToken({
188
+ name: 'FalseLiteral',
189
+ pattern: /FALSE/
190
+ });
191
+ var NullLiteral = createToken({
192
+ name: 'NullLiteral',
193
+ pattern: /NULL/
194
+ });
195
+ var LSquare = createToken({
196
+ name: 'LSquare',
197
+ pattern: /\[/
198
+ });
199
+ var RSquare = createToken({
200
+ name: 'RSquare',
201
+ pattern: /]/
202
+ });
203
+ var LCurly = createToken({
204
+ name: 'LCurly',
205
+ pattern: /{/
206
+ });
207
+ var RCurly = createToken({
208
+ name: 'RCurly',
209
+ pattern: /}/
210
+ });
211
+ var Comment = createToken({
212
+ name: 'Comment',
213
+ pattern: /#.*/,
214
+ group: _chevrotainModuleMin.default.Lexer.SKIPPED // eslint-disable-line no-undef
215
+
216
+ }); // commas, blanks, tabs, newlines and carriage returns are whitespace characters wherever they appear outside of string fields
217
+
218
+ var WhiteSpace = createToken({
219
+ name: 'WhiteSpace',
220
+ pattern: /[ ,\s]/,
221
+ group: _chevrotainModuleMin.default.Lexer.SKIPPED // eslint-disable-line no-undef
222
+
223
+ });
224
+ var tokens = [WhiteSpace, // keywords appear before the Identifier
225
+ NodeName, DEF, USE, ROUTE, TO, TrueLiteral, FalseLiteral, NullLiteral, // the Identifier must appear after the keywords because all keywords are valid identifiers
226
+ Version, Identifier, RouteIdentifier, StringLiteral, HexLiteral, NumberLiteral, LSquare, RSquare, LCurly, RCurly, Comment];
227
+ var tokenVocabulary = {};
228
+
229
+ for (var i = 0, l = tokens.length; i < l; i++) {
230
+ var token = tokens[i];
231
+ tokenVocabulary[token.name] = token;
232
+ }
233
+
234
+ return {
235
+ tokens: tokens,
236
+ tokenVocabulary: tokenVocabulary
237
+ };
238
+ }
239
+
240
+ function createVisitor(BaseVRMLVisitor) {
241
+ // the visitor is created dynmaically based on the given base class
242
+ function VRMLToASTVisitor() {
243
+ BaseVRMLVisitor.call(this);
244
+ this.validateVisitor();
245
+ }
246
+
247
+ VRMLToASTVisitor.prototype = Object.assign(Object.create(BaseVRMLVisitor.prototype), {
248
+ constructor: VRMLToASTVisitor,
249
+ vrml: function vrml(ctx) {
250
+ var data = {
251
+ version: this.visit(ctx.version),
252
+ nodes: [],
253
+ routes: []
254
+ };
255
+
256
+ for (var i = 0, l = ctx.node.length; i < l; i++) {
257
+ var node = ctx.node[i];
258
+ data.nodes.push(this.visit(node));
259
+ }
260
+
261
+ if (ctx.route) {
262
+ for (var _i = 0, _l = ctx.route.length; _i < _l; _i++) {
263
+ var route = ctx.route[_i];
264
+ data.routes.push(this.visit(route));
265
+ }
266
+ }
267
+
268
+ return data;
269
+ },
270
+ version: function version(ctx) {
271
+ return ctx.Version[0].image;
272
+ },
273
+ node: function node(ctx) {
274
+ var data = {
275
+ name: ctx.NodeName[0].image,
276
+ fields: []
277
+ };
278
+
279
+ if (ctx.field) {
280
+ for (var i = 0, l = ctx.field.length; i < l; i++) {
281
+ var field = ctx.field[i];
282
+ data.fields.push(this.visit(field));
283
+ }
284
+ } // DEF
285
+
286
+
287
+ if (ctx.def) {
288
+ data.DEF = this.visit(ctx.def[0]);
289
+ }
290
+
291
+ return data;
292
+ },
293
+ field: function field(ctx) {
294
+ var data = {
295
+ name: ctx.Identifier[0].image,
296
+ type: null,
297
+ values: null
298
+ };
299
+ var result; // SFValue
300
+
301
+ if (ctx.singleFieldValue) {
302
+ result = this.visit(ctx.singleFieldValue[0]);
303
+ } // MFValue
304
+
305
+
306
+ if (ctx.multiFieldValue) {
307
+ result = this.visit(ctx.multiFieldValue[0]);
308
+ }
309
+
310
+ data.type = result.type;
311
+ data.values = result.values;
312
+ return data;
313
+ },
314
+ def: function def(ctx) {
315
+ return (ctx.Identifier || ctx.NodeName)[0].image;
316
+ },
317
+ use: function use(ctx) {
318
+ return {
319
+ USE: (ctx.Identifier || ctx.NodeName)[0].image
320
+ };
321
+ },
322
+ singleFieldValue: function singleFieldValue(ctx) {
323
+ return processField(this, ctx);
324
+ },
325
+ multiFieldValue: function multiFieldValue(ctx) {
326
+ return processField(this, ctx);
327
+ },
328
+ route: function route(ctx) {
329
+ var data = {
330
+ FROM: ctx.RouteIdentifier[0].image,
331
+ TO: ctx.RouteIdentifier[1].image
332
+ };
333
+ return data;
334
+ }
335
+ });
336
+
337
+ function processField(scope, ctx) {
338
+ var field = {
339
+ type: null,
340
+ values: []
341
+ };
342
+
343
+ if (ctx.node) {
344
+ field.type = 'node';
345
+
346
+ for (var i = 0, l = ctx.node.length; i < l; i++) {
347
+ var node = ctx.node[i];
348
+ field.values.push(scope.visit(node));
349
+ }
350
+ }
351
+
352
+ if (ctx.use) {
353
+ field.type = 'use';
354
+
355
+ for (var _i2 = 0, _l2 = ctx.use.length; _i2 < _l2; _i2++) {
356
+ var use = ctx.use[_i2];
357
+ field.values.push(scope.visit(use));
358
+ }
359
+ }
360
+
361
+ if (ctx.StringLiteral) {
362
+ field.type = 'string';
363
+
364
+ for (var _i3 = 0, _l3 = ctx.StringLiteral.length; _i3 < _l3; _i3++) {
365
+ var stringLiteral = ctx.StringLiteral[_i3];
366
+ field.values.push(stringLiteral.image.replace(/'|"/g, ''));
367
+ }
368
+ }
369
+
370
+ if (ctx.NumberLiteral) {
371
+ field.type = 'number';
372
+
373
+ for (var _i4 = 0, _l4 = ctx.NumberLiteral.length; _i4 < _l4; _i4++) {
374
+ var numberLiteral = ctx.NumberLiteral[_i4];
375
+ field.values.push(parseFloat(numberLiteral.image));
376
+ }
377
+ }
378
+
379
+ if (ctx.HexLiteral) {
380
+ field.type = 'hex';
381
+
382
+ for (var _i5 = 0, _l5 = ctx.HexLiteral.length; _i5 < _l5; _i5++) {
383
+ var hexLiteral = ctx.HexLiteral[_i5];
384
+ field.values.push(hexLiteral.image);
385
+ }
386
+ }
387
+
388
+ if (ctx.TrueLiteral) {
389
+ field.type = 'boolean';
390
+
391
+ for (var _i6 = 0, _l6 = ctx.TrueLiteral.length; _i6 < _l6; _i6++) {
392
+ var trueLiteral = ctx.TrueLiteral[_i6];
393
+ if (trueLiteral.image === 'TRUE') field.values.push(true);
394
+ }
395
+ }
396
+
397
+ if (ctx.FalseLiteral) {
398
+ field.type = 'boolean';
399
+
400
+ for (var _i7 = 0, _l7 = ctx.FalseLiteral.length; _i7 < _l7; _i7++) {
401
+ var falseLiteral = ctx.FalseLiteral[_i7];
402
+ if (falseLiteral.image === 'FALSE') field.values.push(false);
403
+ }
404
+ }
405
+
406
+ if (ctx.NullLiteral) {
407
+ field.type = 'null';
408
+ ctx.NullLiteral.forEach(function () {
409
+ field.values.push(null);
410
+ });
411
+ }
412
+
413
+ return field;
414
+ }
415
+
416
+ return new VRMLToASTVisitor();
417
+ }
418
+
419
+ function parseTree(tree) {
420
+ // console.log( JSON.stringify( tree, null, 2 ) );
421
+ var nodes = tree.nodes;
422
+ var scene = new _three.Scene(); // first iteration: build nodemap based on DEF statements
423
+
424
+ for (var i = 0, l = nodes.length; i < l; i++) {
425
+ var node = nodes[i];
426
+ buildNodeMap(node);
427
+ } // second iteration: build nodes
428
+
429
+
430
+ for (var _i8 = 0, _l8 = nodes.length; _i8 < _l8; _i8++) {
431
+ var _node = nodes[_i8];
432
+ var object = getNode(_node);
433
+ if (object instanceof _three.Object3D) scene.add(object);
434
+ if (_node.name === 'WorldInfo') scene.userData.worldInfo = object;
435
+ }
436
+
437
+ return scene;
438
+ }
439
+
440
+ function buildNodeMap(node) {
441
+ if (node.DEF) {
442
+ nodeMap[node.DEF] = node;
443
+ }
444
+
445
+ var fields = node.fields;
446
+
447
+ for (var i = 0, l = fields.length; i < l; i++) {
448
+ var field = fields[i];
449
+
450
+ if (field.type === 'node') {
451
+ var fieldValues = field.values;
452
+
453
+ for (var j = 0, jl = fieldValues.length; j < jl; j++) {
454
+ buildNodeMap(fieldValues[j]);
455
+ }
456
+ }
457
+ }
458
+ }
459
+
460
+ function getNode(node) {
461
+ // handle case where a node refers to a different one
462
+ if (node.USE) {
463
+ return resolveUSE(node.USE);
464
+ }
465
+
466
+ if (node.build !== undefined) return node.build;
467
+ node.build = buildNode(node);
468
+ return node.build;
469
+ } // node builder
470
+
471
+
472
+ function buildNode(node) {
473
+ var nodeName = node.name;
474
+ var build;
475
+
476
+ switch (nodeName) {
477
+ case 'Group':
478
+ case 'Transform':
479
+ case 'Collision':
480
+ build = buildGroupingNode(node);
481
+ break;
482
+
483
+ case 'Background':
484
+ build = buildBackgroundNode(node);
485
+ break;
486
+
487
+ case 'Shape':
488
+ build = buildShapeNode(node);
489
+ break;
490
+
491
+ case 'Appearance':
492
+ build = buildAppearanceNode(node);
493
+ break;
494
+
495
+ case 'Material':
496
+ build = buildMaterialNode(node);
497
+ break;
498
+
499
+ case 'ImageTexture':
500
+ build = buildImageTextureNode(node);
501
+ break;
502
+
503
+ case 'PixelTexture':
504
+ build = buildPixelTextureNode(node);
505
+ break;
506
+
507
+ case 'TextureTransform':
508
+ build = buildTextureTransformNode(node);
509
+ break;
510
+
511
+ case 'IndexedFaceSet':
512
+ build = buildIndexedFaceSetNode(node);
513
+ break;
514
+
515
+ case 'IndexedLineSet':
516
+ build = buildIndexedLineSetNode(node);
517
+ break;
518
+
519
+ case 'PointSet':
520
+ build = buildPointSetNode(node);
521
+ break;
522
+
523
+ case 'Box':
524
+ build = buildBoxNode(node);
525
+ break;
526
+
527
+ case 'Cone':
528
+ build = buildConeNode(node);
529
+ break;
530
+
531
+ case 'Cylinder':
532
+ build = buildCylinderNode(node);
533
+ break;
534
+
535
+ case 'Sphere':
536
+ build = buildSphereNode(node);
537
+ break;
538
+
539
+ case 'ElevationGrid':
540
+ build = buildElevationGridNode(node);
541
+ break;
542
+
543
+ case 'Extrusion':
544
+ build = buildExtrusionNode(node);
545
+ break;
546
+
547
+ case 'Color':
548
+ case 'Coordinate':
549
+ case 'Normal':
550
+ case 'TextureCoordinate':
551
+ build = buildGeometricNode(node);
552
+ break;
553
+
554
+ case 'WorldInfo':
555
+ build = buildWorldInfoNode(node);
556
+ break;
557
+
558
+ case 'Anchor':
559
+ case 'Billboard':
560
+ case 'Inline':
561
+ case 'LOD':
562
+ case 'Switch':
563
+ case 'AudioClip':
564
+ case 'DirectionalLight':
565
+ case 'PointLight':
566
+ case 'Script':
567
+ case 'Sound':
568
+ case 'SpotLight':
569
+ case 'CylinderSensor':
570
+ case 'PlaneSensor':
571
+ case 'ProximitySensor':
572
+ case 'SphereSensor':
573
+ case 'TimeSensor':
574
+ case 'TouchSensor':
575
+ case 'VisibilitySensor':
576
+ case 'Text':
577
+ case 'FontStyle':
578
+ case 'MovieTexture':
579
+ case 'ColorInterpolator':
580
+ case 'CoordinateInterpolator':
581
+ case 'NormalInterpolator':
582
+ case 'OrientationInterpolator':
583
+ case 'PositionInterpolator':
584
+ case 'ScalarInterpolator':
585
+ case 'Fog':
586
+ case 'NavigationInfo':
587
+ case 'Viewpoint':
588
+ // node not supported yet
589
+ break;
590
+
591
+ default:
592
+ console.warn('THREE.VRMLLoader: Unknown node:', nodeName);
593
+ break;
594
+ }
595
+
596
+ if (build !== undefined && node.DEF !== undefined && build.hasOwnProperty('name') === true) {
597
+ build.name = node.DEF;
598
+ }
599
+
600
+ return build;
601
+ }
602
+
603
+ function buildGroupingNode(node) {
604
+ var object = new _three.Group(); //
605
+
606
+ var fields = node.fields;
607
+
608
+ for (var i = 0, l = fields.length; i < l; i++) {
609
+ var field = fields[i];
610
+ var fieldName = field.name;
611
+ var fieldValues = field.values;
612
+
613
+ switch (fieldName) {
614
+ case 'bboxCenter':
615
+ // field not supported
616
+ break;
617
+
618
+ case 'bboxSize':
619
+ // field not supported
620
+ break;
621
+
622
+ case 'center':
623
+ // field not supported
624
+ break;
625
+
626
+ case 'children':
627
+ parseFieldChildren(fieldValues, object);
628
+ break;
629
+
630
+ case 'collide':
631
+ // field not supported
632
+ break;
633
+
634
+ case 'rotation':
635
+ var axis = new _three.Vector3(fieldValues[0], fieldValues[1], fieldValues[2]);
636
+ var angle = fieldValues[3];
637
+ object.quaternion.setFromAxisAngle(axis, angle);
638
+ break;
639
+
640
+ case 'scale':
641
+ object.scale.set(fieldValues[0], fieldValues[1], fieldValues[2]);
642
+ break;
643
+
644
+ case 'scaleOrientation':
645
+ // field not supported
646
+ break;
647
+
648
+ case 'translation':
649
+ object.position.set(fieldValues[0], fieldValues[1], fieldValues[2]);
650
+ break;
651
+
652
+ case 'proxy':
653
+ // field not supported
654
+ break;
655
+
656
+ default:
657
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
658
+ break;
659
+ }
660
+ }
661
+
662
+ return object;
663
+ }
664
+
665
+ function buildBackgroundNode(node) {
666
+ var group = new _three.Group();
667
+ var groundAngle, groundColor;
668
+ var skyAngle, skyColor;
669
+ var fields = node.fields;
670
+
671
+ for (var i = 0, l = fields.length; i < l; i++) {
672
+ var field = fields[i];
673
+ var fieldName = field.name;
674
+ var fieldValues = field.values;
675
+
676
+ switch (fieldName) {
677
+ case 'groundAngle':
678
+ groundAngle = fieldValues;
679
+ break;
680
+
681
+ case 'groundColor':
682
+ groundColor = fieldValues;
683
+ break;
684
+
685
+ case 'backUrl':
686
+ // field not supported
687
+ break;
688
+
689
+ case 'bottomUrl':
690
+ // field not supported
691
+ break;
692
+
693
+ case 'frontUrl':
694
+ // field not supported
695
+ break;
696
+
697
+ case 'leftUrl':
698
+ // field not supported
699
+ break;
700
+
701
+ case 'rightUrl':
702
+ // field not supported
703
+ break;
704
+
705
+ case 'topUrl':
706
+ // field not supported
707
+ break;
708
+
709
+ case 'skyAngle':
710
+ skyAngle = fieldValues;
711
+ break;
712
+
713
+ case 'skyColor':
714
+ skyColor = fieldValues;
715
+ break;
716
+
717
+ default:
718
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
719
+ break;
720
+ }
721
+ }
722
+
723
+ var radius = 10000; // sky
724
+
725
+ if (skyColor) {
726
+ var skyGeometry = new _three.SphereGeometry(radius, 32, 16);
727
+ var skyMaterial = new _three.MeshBasicMaterial({
728
+ fog: false,
729
+ side: _three.BackSide,
730
+ depthWrite: false,
731
+ depthTest: false
732
+ });
733
+
734
+ if (skyColor.length > 3) {
735
+ paintFaces(skyGeometry, radius, skyAngle, toColorArray(skyColor), true);
736
+ skyMaterial.vertexColors = true;
737
+ } else {
738
+ skyMaterial.color.setRGB(skyColor[0], skyColor[1], skyColor[2]);
739
+ }
740
+
741
+ var sky = new _three.Mesh(skyGeometry, skyMaterial);
742
+ group.add(sky);
743
+ } // ground
744
+
745
+
746
+ if (groundColor) {
747
+ if (groundColor.length > 0) {
748
+ var groundGeometry = new _three.SphereGeometry(radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI);
749
+ var groundMaterial = new _three.MeshBasicMaterial({
750
+ fog: false,
751
+ side: _three.BackSide,
752
+ vertexColors: true,
753
+ depthWrite: false,
754
+ depthTest: false
755
+ });
756
+ paintFaces(groundGeometry, radius, groundAngle, toColorArray(groundColor), false);
757
+ var ground = new _three.Mesh(groundGeometry, groundMaterial);
758
+ group.add(ground);
759
+ }
760
+ } // render background group first
761
+
762
+
763
+ group.renderOrder = -Infinity;
764
+ return group;
765
+ }
766
+
767
+ function buildShapeNode(node) {
768
+ var fields = node.fields; // if the appearance field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
769
+
770
+ var material = new _three.MeshBasicMaterial({
771
+ color: 0x000000
772
+ });
773
+ var geometry;
774
+
775
+ for (var i = 0, l = fields.length; i < l; i++) {
776
+ var field = fields[i];
777
+ var fieldName = field.name;
778
+ var fieldValues = field.values;
779
+
780
+ switch (fieldName) {
781
+ case 'appearance':
782
+ if (fieldValues[0] !== null) {
783
+ material = getNode(fieldValues[0]);
784
+ }
785
+
786
+ break;
787
+
788
+ case 'geometry':
789
+ if (fieldValues[0] !== null) {
790
+ geometry = getNode(fieldValues[0]);
791
+ }
792
+
793
+ break;
794
+
795
+ default:
796
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
797
+ break;
798
+ }
799
+ } // build 3D object
800
+
801
+
802
+ var object;
803
+
804
+ if (geometry && geometry.attributes.position) {
805
+ var type = geometry._type;
806
+
807
+ if (type === 'points') {
808
+ // points
809
+ var pointsMaterial = new _three.PointsMaterial({
810
+ color: 0xffffff
811
+ });
812
+
813
+ if (geometry.attributes.color !== undefined) {
814
+ pointsMaterial.vertexColors = true;
815
+ } else {
816
+ // 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
817
+ if (material.isMeshPhongMaterial) {
818
+ pointsMaterial.color.copy(material.emissive);
819
+ }
820
+ }
821
+
822
+ object = new _three.Points(geometry, pointsMaterial);
823
+ } else if (type === 'line') {
824
+ // lines
825
+ var lineMaterial = new _three.LineBasicMaterial({
826
+ color: 0xffffff
827
+ });
828
+
829
+ if (geometry.attributes.color !== undefined) {
830
+ lineMaterial.vertexColors = true;
831
+ } else {
832
+ // 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
833
+ if (material.isMeshPhongMaterial) {
834
+ lineMaterial.color.copy(material.emissive);
835
+ }
836
+ }
837
+
838
+ object = new _three.LineSegments(geometry, lineMaterial);
839
+ } else {
840
+ // consider meshes
841
+ // check "solid" hint (it's placed in the geometry but affects the material)
842
+ if (geometry._solid !== undefined) {
843
+ material.side = geometry._solid ? _three.FrontSide : _three.DoubleSide;
844
+ } // check for vertex colors
845
+
846
+
847
+ if (geometry.attributes.color !== undefined) {
848
+ material.vertexColors = true;
849
+ }
850
+
851
+ object = new _three.Mesh(geometry, material);
852
+ }
853
+ } else {
854
+ object = new _three.Object3D(); // if the geometry field is NULL or no vertices are defined the object is not drawn
855
+
856
+ object.visible = false;
857
+ }
858
+
859
+ return object;
860
+ }
861
+
862
+ function buildAppearanceNode(node) {
863
+ var material = new _three.MeshPhongMaterial();
864
+ var transformData;
865
+ var fields = node.fields;
866
+
867
+ for (var i = 0, l = fields.length; i < l; i++) {
868
+ var field = fields[i];
869
+ var fieldName = field.name;
870
+ var fieldValues = field.values;
871
+
872
+ switch (fieldName) {
873
+ case 'material':
874
+ if (fieldValues[0] !== null) {
875
+ var materialData = getNode(fieldValues[0]);
876
+ if (materialData.diffuseColor) material.color.copy(materialData.diffuseColor);
877
+ if (materialData.emissiveColor) material.emissive.copy(materialData.emissiveColor);
878
+ if (materialData.shininess) material.shininess = materialData.shininess;
879
+ if (materialData.specularColor) material.specular.copy(materialData.specularColor);
880
+ if (materialData.transparency) material.opacity = 1 - materialData.transparency;
881
+ if (materialData.transparency > 0) material.transparent = true;
882
+ } else {
883
+ // if the material field is NULL or unspecified, lighting is off and the unlit object color is (0, 0, 0)
884
+ material = new _three.MeshBasicMaterial({
885
+ color: 0x000000
886
+ });
887
+ }
888
+
889
+ break;
890
+
891
+ case 'texture':
892
+ var textureNode = fieldValues[0];
893
+
894
+ if (textureNode !== null) {
895
+ if (textureNode.name === 'ImageTexture' || textureNode.name === 'PixelTexture') {
896
+ material.map = getNode(textureNode);
897
+ } else {// MovieTexture not supported yet
898
+ }
899
+ }
900
+
901
+ break;
902
+
903
+ case 'textureTransform':
904
+ if (fieldValues[0] !== null) {
905
+ transformData = getNode(fieldValues[0]);
906
+ }
907
+
908
+ break;
909
+
910
+ default:
911
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
912
+ break;
913
+ }
914
+ } // only apply texture transform data if a texture was defined
915
+
916
+
917
+ if (material.map) {
918
+ // respect VRML lighting model
919
+ if (material.map.__type) {
920
+ switch (material.map.__type) {
921
+ case TEXTURE_TYPE.INTENSITY_ALPHA:
922
+ material.opacity = 1; // ignore transparency
923
+
924
+ break;
925
+
926
+ case TEXTURE_TYPE.RGB:
927
+ material.color.set(0xffffff); // ignore material color
928
+
929
+ break;
930
+
931
+ case TEXTURE_TYPE.RGBA:
932
+ material.color.set(0xffffff); // ignore material color
933
+
934
+ material.opacity = 1; // ignore transparency
935
+
936
+ break;
937
+
938
+ default:
939
+ }
940
+
941
+ delete material.map.__type;
942
+ } // apply texture transform
943
+
944
+
945
+ if (transformData) {
946
+ material.map.center.copy(transformData.center);
947
+ material.map.rotation = transformData.rotation;
948
+ material.map.repeat.copy(transformData.scale);
949
+ material.map.offset.copy(transformData.translation);
950
+ }
951
+ }
952
+
953
+ return material;
954
+ }
955
+
956
+ function buildMaterialNode(node) {
957
+ var materialData = {};
958
+ var fields = node.fields;
959
+
960
+ for (var i = 0, l = fields.length; i < l; i++) {
961
+ var field = fields[i];
962
+ var fieldName = field.name;
963
+ var fieldValues = field.values;
964
+
965
+ switch (fieldName) {
966
+ case 'ambientIntensity':
967
+ // field not supported
968
+ break;
969
+
970
+ case 'diffuseColor':
971
+ materialData.diffuseColor = new _three.Color(fieldValues[0], fieldValues[1], fieldValues[2]);
972
+ break;
973
+
974
+ case 'emissiveColor':
975
+ materialData.emissiveColor = new _three.Color(fieldValues[0], fieldValues[1], fieldValues[2]);
976
+ break;
977
+
978
+ case 'shininess':
979
+ materialData.shininess = fieldValues[0];
980
+ break;
981
+
982
+ case 'specularColor':
983
+ materialData.emissiveColor = new _three.Color(fieldValues[0], fieldValues[1], fieldValues[2]);
984
+ break;
985
+
986
+ case 'transparency':
987
+ materialData.transparency = fieldValues[0];
988
+ break;
989
+
990
+ default:
991
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
992
+ break;
993
+ }
994
+ }
995
+
996
+ return materialData;
997
+ }
998
+
999
+ function parseHexColor(hex, textureType, color) {
1000
+ var value;
1001
+
1002
+ switch (textureType) {
1003
+ case TEXTURE_TYPE.INTENSITY:
1004
+ // Intensity texture: A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image
1005
+ value = parseInt(hex);
1006
+ color.r = value;
1007
+ color.g = value;
1008
+ color.b = value;
1009
+ break;
1010
+
1011
+ case TEXTURE_TYPE.INTENSITY_ALPHA:
1012
+ // Intensity+Alpha texture: A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte.
1013
+ value = parseInt('0x' + hex.substring(2, 4));
1014
+ color.r = value;
1015
+ color.g = value;
1016
+ color.b = value;
1017
+ color.a = parseInt('0x' + hex.substring(4, 6));
1018
+ break;
1019
+
1020
+ case TEXTURE_TYPE.RGB:
1021
+ // RGB texture: Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components
1022
+ color.r = parseInt('0x' + hex.substring(2, 4));
1023
+ color.g = parseInt('0x' + hex.substring(4, 6));
1024
+ color.b = parseInt('0x' + hex.substring(6, 8));
1025
+ break;
1026
+
1027
+ case TEXTURE_TYPE.RGBA:
1028
+ // RGBA texture: Four-component images specify the alpha opacity byte after red/green/blue
1029
+ color.r = parseInt('0x' + hex.substring(2, 4));
1030
+ color.g = parseInt('0x' + hex.substring(4, 6));
1031
+ color.b = parseInt('0x' + hex.substring(6, 8));
1032
+ color.a = parseInt('0x' + hex.substring(8, 10));
1033
+ break;
1034
+
1035
+ default:
1036
+ }
1037
+ }
1038
+
1039
+ function getTextureType(num_components) {
1040
+ var type;
1041
+
1042
+ switch (num_components) {
1043
+ case 1:
1044
+ type = TEXTURE_TYPE.INTENSITY;
1045
+ break;
1046
+
1047
+ case 2:
1048
+ type = TEXTURE_TYPE.INTENSITY_ALPHA;
1049
+ break;
1050
+
1051
+ case 3:
1052
+ type = TEXTURE_TYPE.RGB;
1053
+ break;
1054
+
1055
+ case 4:
1056
+ type = TEXTURE_TYPE.RGBA;
1057
+ break;
1058
+
1059
+ default:
1060
+ }
1061
+
1062
+ return type;
1063
+ }
1064
+
1065
+ function buildPixelTextureNode(node) {
1066
+ var texture;
1067
+ var wrapS = _three.RepeatWrapping;
1068
+ var wrapT = _three.RepeatWrapping;
1069
+ var fields = node.fields;
1070
+
1071
+ for (var i = 0, l = fields.length; i < l; i++) {
1072
+ var field = fields[i];
1073
+ var fieldName = field.name;
1074
+ var fieldValues = field.values;
1075
+
1076
+ switch (fieldName) {
1077
+ case 'image':
1078
+ var width = fieldValues[0];
1079
+ var height = fieldValues[1];
1080
+ var num_components = fieldValues[2];
1081
+ var useAlpha = num_components === 2 || num_components === 4;
1082
+ var textureType = getTextureType(num_components);
1083
+ var size = (useAlpha === true ? 4 : 3) * (width * height);
1084
+
1085
+ var _data = new Uint8Array(size);
1086
+
1087
+ var color = {
1088
+ r: 0,
1089
+ g: 0,
1090
+ b: 0,
1091
+ a: 0
1092
+ };
1093
+
1094
+ for (var j = 3, k = 0, jl = fieldValues.length; j < jl; j++, k++) {
1095
+ parseHexColor(fieldValues[j], textureType, color);
1096
+
1097
+ if (useAlpha === true) {
1098
+ var stride = k * 4;
1099
+ _data[stride + 0] = color.r;
1100
+ _data[stride + 1] = color.g;
1101
+ _data[stride + 2] = color.b;
1102
+ _data[stride + 3] = color.a;
1103
+ } else {
1104
+ var _stride = k * 3;
1105
+
1106
+ _data[_stride + 0] = color.r;
1107
+ _data[_stride + 1] = color.g;
1108
+ _data[_stride + 2] = color.b;
1109
+ }
1110
+ }
1111
+
1112
+ texture = new _three.DataTexture(_data, width, height, useAlpha === true ? _three.RGBAFormat : _three.RGBFormat);
1113
+ texture.__type = textureType; // needed for material modifications
1114
+
1115
+ break;
1116
+
1117
+ case 'repeatS':
1118
+ if (fieldValues[0] === false) wrapS = _three.ClampToEdgeWrapping;
1119
+ break;
1120
+
1121
+ case 'repeatT':
1122
+ if (fieldValues[0] === false) wrapT = _three.ClampToEdgeWrapping;
1123
+ break;
1124
+
1125
+ default:
1126
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1127
+ break;
1128
+ }
1129
+ }
1130
+
1131
+ if (texture) {
1132
+ texture.wrapS = wrapS;
1133
+ texture.wrapT = wrapT;
1134
+ }
1135
+
1136
+ return texture;
1137
+ }
1138
+
1139
+ function buildImageTextureNode(node) {
1140
+ var texture;
1141
+ var wrapS = _three.RepeatWrapping;
1142
+ var wrapT = _three.RepeatWrapping;
1143
+ var fields = node.fields;
1144
+
1145
+ for (var i = 0, l = fields.length; i < l; i++) {
1146
+ var field = fields[i];
1147
+ var fieldName = field.name;
1148
+ var fieldValues = field.values;
1149
+
1150
+ switch (fieldName) {
1151
+ case 'url':
1152
+ var url = fieldValues[0];
1153
+ if (url) texture = textureLoader.load(url);
1154
+ break;
1155
+
1156
+ case 'repeatS':
1157
+ if (fieldValues[0] === false) wrapS = _three.ClampToEdgeWrapping;
1158
+ break;
1159
+
1160
+ case 'repeatT':
1161
+ if (fieldValues[0] === false) wrapT = _three.ClampToEdgeWrapping;
1162
+ break;
1163
+
1164
+ default:
1165
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1166
+ break;
1167
+ }
1168
+ }
1169
+
1170
+ if (texture) {
1171
+ texture.wrapS = wrapS;
1172
+ texture.wrapT = wrapT;
1173
+ }
1174
+
1175
+ return texture;
1176
+ }
1177
+
1178
+ function buildTextureTransformNode(node) {
1179
+ var transformData = {
1180
+ center: new _three.Vector2(),
1181
+ rotation: new _three.Vector2(),
1182
+ scale: new _three.Vector2(),
1183
+ translation: new _three.Vector2()
1184
+ };
1185
+ var fields = node.fields;
1186
+
1187
+ for (var i = 0, l = fields.length; i < l; i++) {
1188
+ var field = fields[i];
1189
+ var fieldName = field.name;
1190
+ var fieldValues = field.values;
1191
+
1192
+ switch (fieldName) {
1193
+ case 'center':
1194
+ transformData.center.set(fieldValues[0], fieldValues[1]);
1195
+ break;
1196
+
1197
+ case 'rotation':
1198
+ transformData.rotation = fieldValues[0];
1199
+ break;
1200
+
1201
+ case 'scale':
1202
+ transformData.scale.set(fieldValues[0], fieldValues[1]);
1203
+ break;
1204
+
1205
+ case 'translation':
1206
+ transformData.translation.set(fieldValues[0], fieldValues[1]);
1207
+ break;
1208
+
1209
+ default:
1210
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1211
+ break;
1212
+ }
1213
+ }
1214
+
1215
+ return transformData;
1216
+ }
1217
+
1218
+ function buildGeometricNode(node) {
1219
+ return node.fields[0].values;
1220
+ }
1221
+
1222
+ function buildWorldInfoNode(node) {
1223
+ var worldInfo = {};
1224
+ var fields = node.fields;
1225
+
1226
+ for (var i = 0, l = fields.length; i < l; i++) {
1227
+ var field = fields[i];
1228
+ var fieldName = field.name;
1229
+ var fieldValues = field.values;
1230
+
1231
+ switch (fieldName) {
1232
+ case 'title':
1233
+ worldInfo.title = fieldValues[0];
1234
+ break;
1235
+
1236
+ case 'info':
1237
+ worldInfo.info = fieldValues;
1238
+ break;
1239
+
1240
+ default:
1241
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1242
+ break;
1243
+ }
1244
+ }
1245
+
1246
+ return worldInfo;
1247
+ }
1248
+
1249
+ function buildIndexedFaceSetNode(node) {
1250
+ var color, coord, normal, texCoord;
1251
+ var ccw = true,
1252
+ solid = true,
1253
+ creaseAngle = 0;
1254
+ var colorIndex, coordIndex, normalIndex, texCoordIndex;
1255
+ var colorPerVertex = true,
1256
+ normalPerVertex = true;
1257
+ var fields = node.fields;
1258
+
1259
+ for (var i = 0, l = fields.length; i < l; i++) {
1260
+ var field = fields[i];
1261
+ var fieldName = field.name;
1262
+ var fieldValues = field.values;
1263
+
1264
+ switch (fieldName) {
1265
+ case 'color':
1266
+ var colorNode = fieldValues[0];
1267
+
1268
+ if (colorNode !== null) {
1269
+ color = getNode(colorNode);
1270
+ }
1271
+
1272
+ break;
1273
+
1274
+ case 'coord':
1275
+ var coordNode = fieldValues[0];
1276
+
1277
+ if (coordNode !== null) {
1278
+ coord = getNode(coordNode);
1279
+ }
1280
+
1281
+ break;
1282
+
1283
+ case 'normal':
1284
+ var normalNode = fieldValues[0];
1285
+
1286
+ if (normalNode !== null) {
1287
+ normal = getNode(normalNode);
1288
+ }
1289
+
1290
+ break;
1291
+
1292
+ case 'texCoord':
1293
+ var texCoordNode = fieldValues[0];
1294
+
1295
+ if (texCoordNode !== null) {
1296
+ texCoord = getNode(texCoordNode);
1297
+ }
1298
+
1299
+ break;
1300
+
1301
+ case 'ccw':
1302
+ ccw = fieldValues[0];
1303
+ break;
1304
+
1305
+ case 'colorIndex':
1306
+ colorIndex = fieldValues;
1307
+ break;
1308
+
1309
+ case 'colorPerVertex':
1310
+ colorPerVertex = fieldValues[0];
1311
+ break;
1312
+
1313
+ case 'convex':
1314
+ // field not supported
1315
+ break;
1316
+
1317
+ case 'coordIndex':
1318
+ coordIndex = fieldValues;
1319
+ break;
1320
+
1321
+ case 'creaseAngle':
1322
+ creaseAngle = fieldValues[0];
1323
+ break;
1324
+
1325
+ case 'normalIndex':
1326
+ normalIndex = fieldValues;
1327
+ break;
1328
+
1329
+ case 'normalPerVertex':
1330
+ normalPerVertex = fieldValues[0];
1331
+ break;
1332
+
1333
+ case 'solid':
1334
+ solid = fieldValues[0];
1335
+ break;
1336
+
1337
+ case 'texCoordIndex':
1338
+ texCoordIndex = fieldValues;
1339
+ break;
1340
+
1341
+ default:
1342
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1343
+ break;
1344
+ }
1345
+ }
1346
+
1347
+ if (coordIndex === undefined) {
1348
+ console.warn('THREE.VRMLLoader: Missing coordIndex.');
1349
+ return new _three.BufferGeometry(); // handle VRML files with incomplete geometry definition
1350
+ }
1351
+
1352
+ var triangulatedCoordIndex = triangulateFaceIndex(coordIndex, ccw);
1353
+ var colorAttribute;
1354
+ var normalAttribute;
1355
+ var uvAttribute;
1356
+
1357
+ if (color) {
1358
+ if (colorPerVertex === true) {
1359
+ if (colorIndex && colorIndex.length > 0) {
1360
+ // if the colorIndex field is not empty, then it is used to choose colors for each vertex of the IndexedFaceSet.
1361
+ var triangulatedColorIndex = triangulateFaceIndex(colorIndex, ccw);
1362
+ colorAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedColorIndex, color, 3);
1363
+ } else {
1364
+ // if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
1365
+ colorAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new _three.Float32BufferAttribute(color, 3));
1366
+ }
1367
+ } else {
1368
+ if (colorIndex && colorIndex.length > 0) {
1369
+ // if the colorIndex field is not empty, then they are used to choose one color for each face of the IndexedFaceSet
1370
+ var flattenFaceColors = flattenData(color, colorIndex);
1371
+ var triangulatedFaceColors = triangulateFaceData(flattenFaceColors, coordIndex);
1372
+ colorAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceColors);
1373
+ } else {
1374
+ // if the colorIndex field is empty, then the color are applied to each face of the IndexedFaceSet in order
1375
+ var _triangulatedFaceColors = triangulateFaceData(color, coordIndex);
1376
+
1377
+ colorAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, _triangulatedFaceColors);
1378
+ }
1379
+ }
1380
+ }
1381
+
1382
+ if (normal) {
1383
+ if (normalPerVertex === true) {
1384
+ // consider vertex normals
1385
+ if (normalIndex && normalIndex.length > 0) {
1386
+ // if the normalIndex field is not empty, then it is used to choose normals for each vertex of the IndexedFaceSet.
1387
+ var triangulatedNormalIndex = triangulateFaceIndex(normalIndex, ccw);
1388
+ normalAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedNormalIndex, normal, 3);
1389
+ } else {
1390
+ // if the normalIndex field is empty, then the coordIndex field is used to choose normals from the Normal node
1391
+ normalAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new _three.Float32BufferAttribute(normal, 3));
1392
+ }
1393
+ } else {
1394
+ // consider face normals
1395
+ if (normalIndex && normalIndex.length > 0) {
1396
+ // if the normalIndex field is not empty, then they are used to choose one normal for each face of the IndexedFaceSet
1397
+ var flattenFaceNormals = flattenData(normal, normalIndex);
1398
+ var triangulatedFaceNormals = triangulateFaceData(flattenFaceNormals, coordIndex);
1399
+ normalAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, triangulatedFaceNormals);
1400
+ } else {
1401
+ // if the normalIndex field is empty, then the normals are applied to each face of the IndexedFaceSet in order
1402
+ var _triangulatedFaceNormals = triangulateFaceData(normal, coordIndex);
1403
+
1404
+ normalAttribute = computeAttributeFromFaceData(triangulatedCoordIndex, _triangulatedFaceNormals);
1405
+ }
1406
+ }
1407
+ } else {
1408
+ // 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
1409
+ normalAttribute = computeNormalAttribute(triangulatedCoordIndex, coord, creaseAngle);
1410
+ }
1411
+
1412
+ if (texCoord) {
1413
+ // texture coordinates are always defined on vertex level
1414
+ if (texCoordIndex && texCoordIndex.length > 0) {
1415
+ // if the texCoordIndex field is not empty, then it is used to choose texture coordinates for each vertex of the IndexedFaceSet.
1416
+ var triangulatedTexCoordIndex = triangulateFaceIndex(texCoordIndex, ccw);
1417
+ uvAttribute = computeAttributeFromIndexedData(triangulatedCoordIndex, triangulatedTexCoordIndex, texCoord, 2);
1418
+ } else {
1419
+ // if the texCoordIndex field is empty, then the coordIndex array is used to choose texture coordinates from the TextureCoordinate node
1420
+ uvAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new _three.Float32BufferAttribute(texCoord, 2));
1421
+ }
1422
+ }
1423
+
1424
+ var geometry = new _three.BufferGeometry();
1425
+ var positionAttribute = toNonIndexedAttribute(triangulatedCoordIndex, new _three.Float32BufferAttribute(coord, 3));
1426
+ geometry.setAttribute('position', positionAttribute);
1427
+ geometry.setAttribute('normal', normalAttribute); // optional attributes
1428
+
1429
+ if (colorAttribute) geometry.setAttribute('color', colorAttribute);
1430
+ if (uvAttribute) geometry.setAttribute('uv', uvAttribute); // "solid" influences the material so let's store it for later use
1431
+
1432
+ geometry._solid = solid;
1433
+ geometry._type = 'mesh';
1434
+ return geometry;
1435
+ }
1436
+
1437
+ function buildIndexedLineSetNode(node) {
1438
+ var color, coord;
1439
+ var colorIndex, coordIndex;
1440
+ var colorPerVertex = true;
1441
+ var fields = node.fields;
1442
+
1443
+ for (var i = 0, l = fields.length; i < l; i++) {
1444
+ var field = fields[i];
1445
+ var fieldName = field.name;
1446
+ var fieldValues = field.values;
1447
+
1448
+ switch (fieldName) {
1449
+ case 'color':
1450
+ var colorNode = fieldValues[0];
1451
+
1452
+ if (colorNode !== null) {
1453
+ color = getNode(colorNode);
1454
+ }
1455
+
1456
+ break;
1457
+
1458
+ case 'coord':
1459
+ var coordNode = fieldValues[0];
1460
+
1461
+ if (coordNode !== null) {
1462
+ coord = getNode(coordNode);
1463
+ }
1464
+
1465
+ break;
1466
+
1467
+ case 'colorIndex':
1468
+ colorIndex = fieldValues;
1469
+ break;
1470
+
1471
+ case 'colorPerVertex':
1472
+ colorPerVertex = fieldValues[0];
1473
+ break;
1474
+
1475
+ case 'coordIndex':
1476
+ coordIndex = fieldValues;
1477
+ break;
1478
+
1479
+ default:
1480
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1481
+ break;
1482
+ }
1483
+ } // build lines
1484
+
1485
+
1486
+ var colorAttribute;
1487
+ var expandedLineIndex = expandLineIndex(coordIndex); // create an index for three.js's linesegment primitive
1488
+
1489
+ if (color) {
1490
+ if (colorPerVertex === true) {
1491
+ if (colorIndex.length > 0) {
1492
+ // if the colorIndex field is not empty, then one color is used for each polyline of the IndexedLineSet.
1493
+ var expandedColorIndex = expandLineIndex(colorIndex); // compute colors for each line segment (rendering primitve)
1494
+
1495
+ colorAttribute = computeAttributeFromIndexedData(expandedLineIndex, expandedColorIndex, color, 3); // compute data on vertex level
1496
+ } else {
1497
+ // if the colorIndex field is empty, then the colors are applied to each polyline of the IndexedLineSet in order.
1498
+ colorAttribute = toNonIndexedAttribute(expandedLineIndex, new _three.Float32BufferAttribute(color, 3));
1499
+ }
1500
+ } else {
1501
+ if (colorIndex.length > 0) {
1502
+ // if the colorIndex field is not empty, then colors are applied to each vertex of the IndexedLineSet
1503
+ var flattenLineColors = flattenData(color, colorIndex); // compute colors for each VRML primitve
1504
+
1505
+ var expandedLineColors = expandLineData(flattenLineColors, coordIndex); // compute colors for each line segment (rendering primitve)
1506
+
1507
+ colorAttribute = computeAttributeFromLineData(expandedLineIndex, expandedLineColors); // compute data on vertex level
1508
+ } else {
1509
+ // if the colorIndex field is empty, then the coordIndex field is used to choose colors from the Color node
1510
+ var _expandedLineColors = expandLineData(color, coordIndex); // compute colors for each line segment (rendering primitve)
1511
+
1512
+
1513
+ colorAttribute = computeAttributeFromLineData(expandedLineIndex, _expandedLineColors); // compute data on vertex level
1514
+ }
1515
+ }
1516
+ } //
1517
+
1518
+
1519
+ var geometry = new _three.BufferGeometry();
1520
+ var positionAttribute = toNonIndexedAttribute(expandedLineIndex, new _three.Float32BufferAttribute(coord, 3));
1521
+ geometry.setAttribute('position', positionAttribute);
1522
+ if (colorAttribute) geometry.setAttribute('color', colorAttribute);
1523
+ geometry._type = 'line';
1524
+ return geometry;
1525
+ }
1526
+
1527
+ function buildPointSetNode(node) {
1528
+ var color, coord;
1529
+ var fields = node.fields;
1530
+
1531
+ for (var i = 0, l = fields.length; i < l; i++) {
1532
+ var field = fields[i];
1533
+ var fieldName = field.name;
1534
+ var fieldValues = field.values;
1535
+
1536
+ switch (fieldName) {
1537
+ case 'color':
1538
+ var colorNode = fieldValues[0];
1539
+
1540
+ if (colorNode !== null) {
1541
+ color = getNode(colorNode);
1542
+ }
1543
+
1544
+ break;
1545
+
1546
+ case 'coord':
1547
+ var coordNode = fieldValues[0];
1548
+
1549
+ if (coordNode !== null) {
1550
+ coord = getNode(coordNode);
1551
+ }
1552
+
1553
+ break;
1554
+
1555
+ default:
1556
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1557
+ break;
1558
+ }
1559
+ }
1560
+
1561
+ var geometry = new _three.BufferGeometry();
1562
+ geometry.setAttribute('position', new _three.Float32BufferAttribute(coord, 3));
1563
+ if (color) geometry.setAttribute('color', new _three.Float32BufferAttribute(color, 3));
1564
+ geometry._type = 'points';
1565
+ return geometry;
1566
+ }
1567
+
1568
+ function buildBoxNode(node) {
1569
+ var size = new _three.Vector3(2, 2, 2);
1570
+ var fields = node.fields;
1571
+
1572
+ for (var i = 0, l = fields.length; i < l; i++) {
1573
+ var field = fields[i];
1574
+ var fieldName = field.name;
1575
+ var fieldValues = field.values;
1576
+
1577
+ switch (fieldName) {
1578
+ case 'size':
1579
+ size.x = fieldValues[0];
1580
+ size.y = fieldValues[1];
1581
+ size.z = fieldValues[2];
1582
+ break;
1583
+
1584
+ default:
1585
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1586
+ break;
1587
+ }
1588
+ }
1589
+
1590
+ var geometry = new _three.BoxGeometry(size.x, size.y, size.z);
1591
+ return geometry;
1592
+ }
1593
+
1594
+ function buildConeNode(node) {
1595
+ var radius = 1,
1596
+ height = 2,
1597
+ openEnded = false;
1598
+ var fields = node.fields;
1599
+
1600
+ for (var i = 0, l = fields.length; i < l; i++) {
1601
+ var field = fields[i];
1602
+ var fieldName = field.name;
1603
+ var fieldValues = field.values;
1604
+
1605
+ switch (fieldName) {
1606
+ case 'bottom':
1607
+ openEnded = !fieldValues[0];
1608
+ break;
1609
+
1610
+ case 'bottomRadius':
1611
+ radius = fieldValues[0];
1612
+ break;
1613
+
1614
+ case 'height':
1615
+ height = fieldValues[0];
1616
+ break;
1617
+
1618
+ case 'side':
1619
+ // field not supported
1620
+ break;
1621
+
1622
+ default:
1623
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1624
+ break;
1625
+ }
1626
+ }
1627
+
1628
+ var geometry = new _three.ConeGeometry(radius, height, 16, 1, openEnded);
1629
+ return geometry;
1630
+ }
1631
+
1632
+ function buildCylinderNode(node) {
1633
+ var radius = 1,
1634
+ height = 2;
1635
+ var fields = node.fields;
1636
+
1637
+ for (var i = 0, l = fields.length; i < l; i++) {
1638
+ var field = fields[i];
1639
+ var fieldName = field.name;
1640
+ var fieldValues = field.values;
1641
+
1642
+ switch (fieldName) {
1643
+ case 'bottom':
1644
+ // field not supported
1645
+ break;
1646
+
1647
+ case 'radius':
1648
+ radius = fieldValues[0];
1649
+ break;
1650
+
1651
+ case 'height':
1652
+ height = fieldValues[0];
1653
+ break;
1654
+
1655
+ case 'side':
1656
+ // field not supported
1657
+ break;
1658
+
1659
+ case 'top':
1660
+ // field not supported
1661
+ break;
1662
+
1663
+ default:
1664
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1665
+ break;
1666
+ }
1667
+ }
1668
+
1669
+ var geometry = new _three.CylinderGeometry(radius, radius, height, 16, 1);
1670
+ return geometry;
1671
+ }
1672
+
1673
+ function buildSphereNode(node) {
1674
+ var radius = 1;
1675
+ var fields = node.fields;
1676
+
1677
+ for (var i = 0, l = fields.length; i < l; i++) {
1678
+ var field = fields[i];
1679
+ var fieldName = field.name;
1680
+ var fieldValues = field.values;
1681
+
1682
+ switch (fieldName) {
1683
+ case 'radius':
1684
+ radius = fieldValues[0];
1685
+ break;
1686
+
1687
+ default:
1688
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1689
+ break;
1690
+ }
1691
+ }
1692
+
1693
+ var geometry = new _three.SphereGeometry(radius, 16, 16);
1694
+ return geometry;
1695
+ }
1696
+
1697
+ function buildElevationGridNode(node) {
1698
+ var color;
1699
+ var normal;
1700
+ var texCoord;
1701
+ var height;
1702
+ var colorPerVertex = true;
1703
+ var normalPerVertex = true;
1704
+ var solid = true;
1705
+ var ccw = true;
1706
+ var creaseAngle = 0;
1707
+ var xDimension = 2;
1708
+ var zDimension = 2;
1709
+ var xSpacing = 1;
1710
+ var zSpacing = 1;
1711
+ var fields = node.fields;
1712
+
1713
+ for (var i = 0, l = fields.length; i < l; i++) {
1714
+ var field = fields[i];
1715
+ var fieldName = field.name;
1716
+ var fieldValues = field.values;
1717
+
1718
+ switch (fieldName) {
1719
+ case 'color':
1720
+ var colorNode = fieldValues[0];
1721
+
1722
+ if (colorNode !== null) {
1723
+ color = getNode(colorNode);
1724
+ }
1725
+
1726
+ break;
1727
+
1728
+ case 'normal':
1729
+ var normalNode = fieldValues[0];
1730
+
1731
+ if (normalNode !== null) {
1732
+ normal = getNode(normalNode);
1733
+ }
1734
+
1735
+ break;
1736
+
1737
+ case 'texCoord':
1738
+ var texCoordNode = fieldValues[0];
1739
+
1740
+ if (texCoordNode !== null) {
1741
+ texCoord = getNode(texCoordNode);
1742
+ }
1743
+
1744
+ break;
1745
+
1746
+ case 'height':
1747
+ height = fieldValues;
1748
+ break;
1749
+
1750
+ case 'ccw':
1751
+ ccw = fieldValues[0];
1752
+ break;
1753
+
1754
+ case 'colorPerVertex':
1755
+ colorPerVertex = fieldValues[0];
1756
+ break;
1757
+
1758
+ case 'creaseAngle':
1759
+ creaseAngle = fieldValues[0];
1760
+ break;
1761
+
1762
+ case 'normalPerVertex':
1763
+ normalPerVertex = fieldValues[0];
1764
+ break;
1765
+
1766
+ case 'solid':
1767
+ solid = fieldValues[0];
1768
+ break;
1769
+
1770
+ case 'xDimension':
1771
+ xDimension = fieldValues[0];
1772
+ break;
1773
+
1774
+ case 'xSpacing':
1775
+ xSpacing = fieldValues[0];
1776
+ break;
1777
+
1778
+ case 'zDimension':
1779
+ zDimension = fieldValues[0];
1780
+ break;
1781
+
1782
+ case 'zSpacing':
1783
+ zSpacing = fieldValues[0];
1784
+ break;
1785
+
1786
+ default:
1787
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1788
+ break;
1789
+ }
1790
+ } // vertex data
1791
+
1792
+
1793
+ var vertices = [];
1794
+ var normals = [];
1795
+ var colors = [];
1796
+ var uvs = [];
1797
+
1798
+ for (var _i9 = 0; _i9 < zDimension; _i9++) {
1799
+ for (var j = 0; j < xDimension; j++) {
1800
+ // compute a row major index
1801
+ var index = _i9 * xDimension + j; // vertices
1802
+
1803
+ var x = xSpacing * _i9;
1804
+ var y = height[index];
1805
+ var z = zSpacing * j;
1806
+ vertices.push(x, y, z); // colors
1807
+
1808
+ if (color && colorPerVertex === true) {
1809
+ var r = color[index * 3 + 0];
1810
+ var g = color[index * 3 + 1];
1811
+ var b = color[index * 3 + 2];
1812
+ colors.push(r, g, b);
1813
+ } // normals
1814
+
1815
+
1816
+ if (normal && normalPerVertex === true) {
1817
+ var xn = normal[index * 3 + 0];
1818
+ var yn = normal[index * 3 + 1];
1819
+ var zn = normal[index * 3 + 2];
1820
+ normals.push(xn, yn, zn);
1821
+ } // uvs
1822
+
1823
+
1824
+ if (texCoord) {
1825
+ var s = texCoord[index * 2 + 0];
1826
+ var t = texCoord[index * 2 + 1];
1827
+ uvs.push(s, t);
1828
+ } else {
1829
+ uvs.push(_i9 / (xDimension - 1), j / (zDimension - 1));
1830
+ }
1831
+ }
1832
+ } // indices
1833
+
1834
+
1835
+ var indices = [];
1836
+
1837
+ for (var _i10 = 0; _i10 < xDimension - 1; _i10++) {
1838
+ for (var _j = 0; _j < zDimension - 1; _j++) {
1839
+ // from https://tecfa.unige.ch/guides/vrml/vrml97/spec/part1/nodesRef.html#ElevationGrid
1840
+ var a = _i10 + _j * xDimension;
1841
+
1842
+ var _b = _i10 + (_j + 1) * xDimension;
1843
+
1844
+ var c = _i10 + 1 + (_j + 1) * xDimension;
1845
+ var d = _i10 + 1 + _j * xDimension; // faces
1846
+
1847
+ if (ccw === true) {
1848
+ indices.push(a, c, _b);
1849
+ indices.push(c, a, d);
1850
+ } else {
1851
+ indices.push(a, _b, c);
1852
+ indices.push(c, d, a);
1853
+ }
1854
+ }
1855
+ } //
1856
+
1857
+
1858
+ var positionAttribute = toNonIndexedAttribute(indices, new _three.Float32BufferAttribute(vertices, 3));
1859
+ var uvAttribute = toNonIndexedAttribute(indices, new _three.Float32BufferAttribute(uvs, 2));
1860
+ var colorAttribute;
1861
+ var normalAttribute; // color attribute
1862
+
1863
+ if (color) {
1864
+ if (colorPerVertex === false) {
1865
+ for (var _i11 = 0; _i11 < xDimension - 1; _i11++) {
1866
+ for (var _j2 = 0; _j2 < zDimension - 1; _j2++) {
1867
+ var _index = _i11 + _j2 * (xDimension - 1);
1868
+
1869
+ var _r = color[_index * 3 + 0];
1870
+ var _g = color[_index * 3 + 1];
1871
+ var _b2 = color[_index * 3 + 2]; // one color per quad
1872
+
1873
+ colors.push(_r, _g, _b2);
1874
+ colors.push(_r, _g, _b2);
1875
+ colors.push(_r, _g, _b2);
1876
+ colors.push(_r, _g, _b2);
1877
+ colors.push(_r, _g, _b2);
1878
+ colors.push(_r, _g, _b2);
1879
+ }
1880
+ }
1881
+
1882
+ colorAttribute = new _three.Float32BufferAttribute(colors, 3);
1883
+ } else {
1884
+ colorAttribute = toNonIndexedAttribute(indices, new _three.Float32BufferAttribute(colors, 3));
1885
+ }
1886
+ } // normal attribute
1887
+
1888
+
1889
+ if (normal) {
1890
+ if (normalPerVertex === false) {
1891
+ for (var _i12 = 0; _i12 < xDimension - 1; _i12++) {
1892
+ for (var _j3 = 0; _j3 < zDimension - 1; _j3++) {
1893
+ var _index2 = _i12 + _j3 * (xDimension - 1);
1894
+
1895
+ var _xn = normal[_index2 * 3 + 0];
1896
+ var _yn = normal[_index2 * 3 + 1];
1897
+ var _zn = normal[_index2 * 3 + 2]; // one normal per quad
1898
+
1899
+ normals.push(_xn, _yn, _zn);
1900
+ normals.push(_xn, _yn, _zn);
1901
+ normals.push(_xn, _yn, _zn);
1902
+ normals.push(_xn, _yn, _zn);
1903
+ normals.push(_xn, _yn, _zn);
1904
+ normals.push(_xn, _yn, _zn);
1905
+ }
1906
+ }
1907
+
1908
+ normalAttribute = new _three.Float32BufferAttribute(normals, 3);
1909
+ } else {
1910
+ normalAttribute = toNonIndexedAttribute(indices, new _three.Float32BufferAttribute(normals, 3));
1911
+ }
1912
+ } else {
1913
+ normalAttribute = computeNormalAttribute(indices, vertices, creaseAngle);
1914
+ } // build geometry
1915
+
1916
+
1917
+ var geometry = new _three.BufferGeometry();
1918
+ geometry.setAttribute('position', positionAttribute);
1919
+ geometry.setAttribute('normal', normalAttribute);
1920
+ geometry.setAttribute('uv', uvAttribute);
1921
+ if (colorAttribute) geometry.setAttribute('color', colorAttribute); // "solid" influences the material so let's store it for later use
1922
+
1923
+ geometry._solid = solid;
1924
+ geometry._type = 'mesh';
1925
+ return geometry;
1926
+ }
1927
+
1928
+ function buildExtrusionNode(node) {
1929
+ var crossSection = [1, 1, 1, -1, -1, -1, -1, 1, 1, 1];
1930
+ var spine = [0, 0, 0, 0, 1, 0];
1931
+ var scale;
1932
+ var orientation;
1933
+ var beginCap = true;
1934
+ var ccw = true;
1935
+ var creaseAngle = 0;
1936
+ var endCap = true;
1937
+ var solid = true;
1938
+ var fields = node.fields;
1939
+
1940
+ for (var i = 0, l = fields.length; i < l; i++) {
1941
+ var field = fields[i];
1942
+ var fieldName = field.name;
1943
+ var fieldValues = field.values;
1944
+
1945
+ switch (fieldName) {
1946
+ case 'beginCap':
1947
+ beginCap = fieldValues[0];
1948
+ break;
1949
+
1950
+ case 'ccw':
1951
+ ccw = fieldValues[0];
1952
+ break;
1953
+
1954
+ case 'convex':
1955
+ // field not supported
1956
+ break;
1957
+
1958
+ case 'creaseAngle':
1959
+ creaseAngle = fieldValues[0];
1960
+ break;
1961
+
1962
+ case 'crossSection':
1963
+ crossSection = fieldValues;
1964
+ break;
1965
+
1966
+ case 'endCap':
1967
+ endCap = fieldValues[0];
1968
+ break;
1969
+
1970
+ case 'orientation':
1971
+ orientation = fieldValues;
1972
+ break;
1973
+
1974
+ case 'scale':
1975
+ scale = fieldValues;
1976
+ break;
1977
+
1978
+ case 'solid':
1979
+ solid = fieldValues[0];
1980
+ break;
1981
+
1982
+ case 'spine':
1983
+ spine = fieldValues; // only extrusion along the Y-axis are supported so far
1984
+
1985
+ break;
1986
+
1987
+ default:
1988
+ console.warn('THREE.VRMLLoader: Unknown field:', fieldName);
1989
+ break;
1990
+ }
1991
+ }
1992
+
1993
+ var crossSectionClosed = crossSection[0] === crossSection[crossSection.length - 2] && crossSection[1] === crossSection[crossSection.length - 1]; // vertices
1994
+
1995
+ var vertices = [];
1996
+ var spineVector = new _three.Vector3();
1997
+ var scaling = new _three.Vector3();
1998
+ var axis = new _three.Vector3();
1999
+ var vertex = new _three.Vector3();
2000
+ var quaternion = new _three.Quaternion();
2001
+
2002
+ for (var _i13 = 0, j = 0, o = 0, il = spine.length; _i13 < il; _i13 += 3, j += 2, o += 4) {
2003
+ spineVector.fromArray(spine, _i13);
2004
+ scaling.x = scale ? scale[j + 0] : 1;
2005
+ scaling.y = 1;
2006
+ scaling.z = scale ? scale[j + 1] : 1;
2007
+ axis.x = orientation ? orientation[o + 0] : 0;
2008
+ axis.y = orientation ? orientation[o + 1] : 0;
2009
+ axis.z = orientation ? orientation[o + 2] : 1;
2010
+ var angle = orientation ? orientation[o + 3] : 0;
2011
+
2012
+ for (var k = 0, kl = crossSection.length; k < kl; k += 2) {
2013
+ vertex.x = crossSection[k + 0];
2014
+ vertex.y = 0;
2015
+ vertex.z = crossSection[k + 1]; // scale
2016
+
2017
+ vertex.multiply(scaling); // rotate
2018
+
2019
+ quaternion.setFromAxisAngle(axis, angle);
2020
+ vertex.applyQuaternion(quaternion); // translate
2021
+
2022
+ vertex.add(spineVector);
2023
+ vertices.push(vertex.x, vertex.y, vertex.z);
2024
+ }
2025
+ } // indices
2026
+
2027
+
2028
+ var indices = [];
2029
+ var spineCount = spine.length / 3;
2030
+ var crossSectionCount = crossSection.length / 2;
2031
+
2032
+ for (var _i14 = 0; _i14 < spineCount - 1; _i14++) {
2033
+ for (var _j4 = 0; _j4 < crossSectionCount - 1; _j4++) {
2034
+ var a = _j4 + _i14 * crossSectionCount;
2035
+ var b = _j4 + 1 + _i14 * crossSectionCount;
2036
+ var c = _j4 + (_i14 + 1) * crossSectionCount;
2037
+ var d = _j4 + 1 + (_i14 + 1) * crossSectionCount;
2038
+
2039
+ if (_j4 === crossSectionCount - 2 && crossSectionClosed === true) {
2040
+ b = _i14 * crossSectionCount;
2041
+ d = (_i14 + 1) * crossSectionCount;
2042
+ }
2043
+
2044
+ if (ccw === true) {
2045
+ indices.push(a, b, c);
2046
+ indices.push(c, b, d);
2047
+ } else {
2048
+ indices.push(a, c, b);
2049
+ indices.push(c, d, b);
2050
+ }
2051
+ }
2052
+ } // triangulate cap
2053
+
2054
+
2055
+ if (beginCap === true || endCap === true) {
2056
+ var contour = [];
2057
+
2058
+ for (var _i15 = 0, _l9 = crossSection.length; _i15 < _l9; _i15 += 2) {
2059
+ contour.push(new _three.Vector2(crossSection[_i15], crossSection[_i15 + 1]));
2060
+ }
2061
+
2062
+ var faces = _three.ShapeUtils.triangulateShape(contour, []);
2063
+
2064
+ var capIndices = [];
2065
+
2066
+ for (var _i16 = 0, _l10 = faces.length; _i16 < _l10; _i16++) {
2067
+ var face = faces[_i16];
2068
+ capIndices.push(face[0], face[1], face[2]);
2069
+ } // begin cap
2070
+
2071
+
2072
+ if (beginCap === true) {
2073
+ for (var _i17 = 0, _l11 = capIndices.length; _i17 < _l11; _i17 += 3) {
2074
+ if (ccw === true) {
2075
+ indices.push(capIndices[_i17 + 0], capIndices[_i17 + 1], capIndices[_i17 + 2]);
2076
+ } else {
2077
+ indices.push(capIndices[_i17 + 0], capIndices[_i17 + 2], capIndices[_i17 + 1]);
2078
+ }
2079
+ }
2080
+ } // end cap
2081
+
2082
+
2083
+ if (endCap === true) {
2084
+ var indexOffset = crossSectionCount * (spineCount - 1); // references to the first vertex of the last cross section
2085
+
2086
+ for (var _i18 = 0, _l12 = capIndices.length; _i18 < _l12; _i18 += 3) {
2087
+ if (ccw === true) {
2088
+ indices.push(indexOffset + capIndices[_i18 + 0], indexOffset + capIndices[_i18 + 2], indexOffset + capIndices[_i18 + 1]);
2089
+ } else {
2090
+ indices.push(indexOffset + capIndices[_i18 + 0], indexOffset + capIndices[_i18 + 1], indexOffset + capIndices[_i18 + 2]);
2091
+ }
2092
+ }
2093
+ }
2094
+ }
2095
+
2096
+ var positionAttribute = toNonIndexedAttribute(indices, new _three.Float32BufferAttribute(vertices, 3));
2097
+ var normalAttribute = computeNormalAttribute(indices, vertices, creaseAngle);
2098
+ var geometry = new _three.BufferGeometry();
2099
+ geometry.setAttribute('position', positionAttribute);
2100
+ geometry.setAttribute('normal', normalAttribute); // no uvs yet
2101
+ // "solid" influences the material so let's store it for later use
2102
+
2103
+ geometry._solid = solid;
2104
+ geometry._type = 'mesh';
2105
+ return geometry;
2106
+ } // helper functions
2107
+
2108
+
2109
+ function resolveUSE(identifier) {
2110
+ var node = nodeMap[identifier];
2111
+ var build = getNode(node); // because the same 3D objects can have different transformations, it's necessary to clone them.
2112
+ // materials can be influenced by the geometry (e.g. vertex normals). cloning is necessary to avoid
2113
+ // any side effects
2114
+
2115
+ return build.isObject3D || build.isMaterial ? build.clone() : build;
2116
+ }
2117
+
2118
+ function parseFieldChildren(children, owner) {
2119
+ for (var i = 0, l = children.length; i < l; i++) {
2120
+ var object = getNode(children[i]);
2121
+ if (object instanceof _three.Object3D) owner.add(object);
2122
+ }
2123
+ }
2124
+
2125
+ function triangulateFaceIndex(index, ccw) {
2126
+ var indices = []; // since face defintions can have more than three vertices, it's necessary to
2127
+ // perform a simple triangulation
2128
+
2129
+ var start = 0;
2130
+
2131
+ for (var i = 0, l = index.length; i < l; i++) {
2132
+ var i1 = index[start];
2133
+ var i2 = index[i + (ccw ? 1 : 2)];
2134
+ var i3 = index[i + (ccw ? 2 : 1)];
2135
+ indices.push(i1, i2, i3); // an index of -1 indicates that the current face has ended and the next one begins
2136
+
2137
+ if (index[i + 3] === -1 || i + 3 >= l) {
2138
+ i += 3;
2139
+ start = i + 1;
2140
+ }
2141
+ }
2142
+
2143
+ return indices;
2144
+ }
2145
+
2146
+ function triangulateFaceData(data, index) {
2147
+ var triangulatedData = [];
2148
+ var start = 0;
2149
+
2150
+ for (var i = 0, l = index.length; i < l; i++) {
2151
+ var stride = start * 3;
2152
+ var x = data[stride];
2153
+ var y = data[stride + 1];
2154
+ var z = data[stride + 2];
2155
+ triangulatedData.push(x, y, z); // an index of -1 indicates that the current face has ended and the next one begins
2156
+
2157
+ if (index[i + 3] === -1 || i + 3 >= l) {
2158
+ i += 3;
2159
+ start++;
2160
+ }
2161
+ }
2162
+
2163
+ return triangulatedData;
2164
+ }
2165
+
2166
+ function flattenData(data, index) {
2167
+ var flattenData = [];
2168
+
2169
+ for (var i = 0, l = index.length; i < l; i++) {
2170
+ var i1 = index[i];
2171
+ var stride = i1 * 3;
2172
+ var x = data[stride];
2173
+ var y = data[stride + 1];
2174
+ var z = data[stride + 2];
2175
+ flattenData.push(x, y, z);
2176
+ }
2177
+
2178
+ return flattenData;
2179
+ }
2180
+
2181
+ function expandLineIndex(index) {
2182
+ var indices = [];
2183
+
2184
+ for (var i = 0, l = index.length; i < l; i++) {
2185
+ var i1 = index[i];
2186
+ var i2 = index[i + 1];
2187
+ indices.push(i1, i2); // an index of -1 indicates that the current line has ended and the next one begins
2188
+
2189
+ if (index[i + 2] === -1 || i + 2 >= l) {
2190
+ i += 2;
2191
+ }
2192
+ }
2193
+
2194
+ return indices;
2195
+ }
2196
+
2197
+ function expandLineData(data, index) {
2198
+ var triangulatedData = [];
2199
+ var start = 0;
2200
+
2201
+ for (var i = 0, l = index.length; i < l; i++) {
2202
+ var stride = start * 3;
2203
+ var x = data[stride];
2204
+ var y = data[stride + 1];
2205
+ var z = data[stride + 2];
2206
+ triangulatedData.push(x, y, z); // an index of -1 indicates that the current line has ended and the next one begins
2207
+
2208
+ if (index[i + 2] === -1 || i + 2 >= l) {
2209
+ i += 2;
2210
+ start++;
2211
+ }
2212
+ }
2213
+
2214
+ return triangulatedData;
2215
+ }
2216
+
2217
+ var vA = new _three.Vector3();
2218
+ var vB = new _three.Vector3();
2219
+ var vC = new _three.Vector3();
2220
+ var uvA = new _three.Vector2();
2221
+ var uvB = new _three.Vector2();
2222
+ var uvC = new _three.Vector2();
2223
+
2224
+ function computeAttributeFromIndexedData(coordIndex, index, data, itemSize) {
2225
+ var array = []; // we use the coordIndex.length as delimiter since normalIndex must contain at least as many indices
2226
+
2227
+ for (var i = 0, l = coordIndex.length; i < l; i += 3) {
2228
+ var a = index[i];
2229
+ var b = index[i + 1];
2230
+ var c = index[i + 2];
2231
+
2232
+ if (itemSize === 2) {
2233
+ uvA.fromArray(data, a * itemSize);
2234
+ uvB.fromArray(data, b * itemSize);
2235
+ uvC.fromArray(data, c * itemSize);
2236
+ array.push(uvA.x, uvA.y);
2237
+ array.push(uvB.x, uvB.y);
2238
+ array.push(uvC.x, uvC.y);
2239
+ } else {
2240
+ vA.fromArray(data, a * itemSize);
2241
+ vB.fromArray(data, b * itemSize);
2242
+ vC.fromArray(data, c * itemSize);
2243
+ array.push(vA.x, vA.y, vA.z);
2244
+ array.push(vB.x, vB.y, vB.z);
2245
+ array.push(vC.x, vC.y, vC.z);
2246
+ }
2247
+ }
2248
+
2249
+ return new _three.Float32BufferAttribute(array, itemSize);
2250
+ }
2251
+
2252
+ function computeAttributeFromFaceData(index, faceData) {
2253
+ var array = [];
2254
+
2255
+ for (var i = 0, j = 0, l = index.length; i < l; i += 3, j++) {
2256
+ vA.fromArray(faceData, j * 3);
2257
+ array.push(vA.x, vA.y, vA.z);
2258
+ array.push(vA.x, vA.y, vA.z);
2259
+ array.push(vA.x, vA.y, vA.z);
2260
+ }
2261
+
2262
+ return new _three.Float32BufferAttribute(array, 3);
2263
+ }
2264
+
2265
+ function computeAttributeFromLineData(index, lineData) {
2266
+ var array = [];
2267
+
2268
+ for (var i = 0, j = 0, l = index.length; i < l; i += 2, j++) {
2269
+ vA.fromArray(lineData, j * 3);
2270
+ array.push(vA.x, vA.y, vA.z);
2271
+ array.push(vA.x, vA.y, vA.z);
2272
+ }
2273
+
2274
+ return new _three.Float32BufferAttribute(array, 3);
2275
+ }
2276
+
2277
+ function toNonIndexedAttribute(indices, attribute) {
2278
+ var array = attribute.array;
2279
+ var itemSize = attribute.itemSize;
2280
+ var array2 = new array.constructor(indices.length * itemSize);
2281
+ var index = 0,
2282
+ index2 = 0;
2283
+
2284
+ for (var i = 0, l = indices.length; i < l; i++) {
2285
+ index = indices[i] * itemSize;
2286
+
2287
+ for (var j = 0; j < itemSize; j++) {
2288
+ array2[index2++] = array[index++];
2289
+ }
2290
+ }
2291
+
2292
+ return new _three.Float32BufferAttribute(array2, itemSize);
2293
+ }
2294
+
2295
+ var ab = new _three.Vector3();
2296
+ var cb = new _three.Vector3();
2297
+
2298
+ function computeNormalAttribute(index, coord, creaseAngle) {
2299
+ var faces = [];
2300
+ var vertexNormals = {}; // prepare face and raw vertex normals
2301
+
2302
+ for (var i = 0, l = index.length; i < l; i += 3) {
2303
+ var a = index[i];
2304
+ var b = index[i + 1];
2305
+ var c = index[i + 2];
2306
+ var face = new Face(a, b, c);
2307
+ vA.fromArray(coord, a * 3);
2308
+ vB.fromArray(coord, b * 3);
2309
+ vC.fromArray(coord, c * 3);
2310
+ cb.subVectors(vC, vB);
2311
+ ab.subVectors(vA, vB);
2312
+ cb.cross(ab);
2313
+ cb.normalize();
2314
+ face.normal.copy(cb);
2315
+ if (vertexNormals[a] === undefined) vertexNormals[a] = [];
2316
+ if (vertexNormals[b] === undefined) vertexNormals[b] = [];
2317
+ if (vertexNormals[c] === undefined) vertexNormals[c] = [];
2318
+ vertexNormals[a].push(face.normal);
2319
+ vertexNormals[b].push(face.normal);
2320
+ vertexNormals[c].push(face.normal);
2321
+ faces.push(face);
2322
+ } // compute vertex normals and build final geometry
2323
+
2324
+
2325
+ var normals = [];
2326
+
2327
+ for (var _i19 = 0, _l13 = faces.length; _i19 < _l13; _i19++) {
2328
+ var _face = faces[_i19];
2329
+ var nA = weightedNormal(vertexNormals[_face.a], _face.normal, creaseAngle);
2330
+ var nB = weightedNormal(vertexNormals[_face.b], _face.normal, creaseAngle);
2331
+ var nC = weightedNormal(vertexNormals[_face.c], _face.normal, creaseAngle);
2332
+ vA.fromArray(coord, _face.a * 3);
2333
+ vB.fromArray(coord, _face.b * 3);
2334
+ vC.fromArray(coord, _face.c * 3);
2335
+ normals.push(nA.x, nA.y, nA.z);
2336
+ normals.push(nB.x, nB.y, nB.z);
2337
+ normals.push(nC.x, nC.y, nC.z);
2338
+ }
2339
+
2340
+ return new _three.Float32BufferAttribute(normals, 3);
2341
+ }
2342
+
2343
+ function weightedNormal(normals, vector, creaseAngle) {
2344
+ var normal = new _three.Vector3();
2345
+
2346
+ if (creaseAngle === 0) {
2347
+ normal.copy(vector);
2348
+ } else {
2349
+ for (var i = 0, l = normals.length; i < l; i++) {
2350
+ if (normals[i].angleTo(vector) < creaseAngle) {
2351
+ normal.add(normals[i]);
2352
+ }
2353
+ }
2354
+ }
2355
+
2356
+ return normal.normalize();
2357
+ }
2358
+
2359
+ function toColorArray(colors) {
2360
+ var array = [];
2361
+
2362
+ for (var i = 0, l = colors.length; i < l; i += 3) {
2363
+ array.push(new _three.Color(colors[i], colors[i + 1], colors[i + 2]));
2364
+ }
2365
+
2366
+ return array;
2367
+ }
2368
+ /**
2369
+ * Vertically paints the faces interpolating between the
2370
+ * specified colors at the specified angels. This is used for the Background
2371
+ * node, but could be applied to other nodes with multiple faces as well.
2372
+ *
2373
+ * When used with the Background node, default is directionIsDown is true if
2374
+ * interpolating the skyColor down from the Zenith. When interpolationg up from
2375
+ * the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
2376
+ *
2377
+ * The first angle is never specified, it is the Zenith (0 rad). Angles are specified
2378
+ * in radians. The geometry is thought a sphere, but could be anything. The color interpolation
2379
+ * is linear along the Y axis in any case.
2380
+ *
2381
+ * You must specify one more color than you have angles at the beginning of the colors array.
2382
+ * This is the color of the Zenith (the top of the shape).
2383
+ *
2384
+ * @param {BufferGeometry} geometry
2385
+ * @param {number} radius
2386
+ * @param {array} angles
2387
+ * @param {array} colors
2388
+ * @param {boolean} topDown - Whether to work top down or bottom up.
2389
+ */
2390
+
2391
+
2392
+ function paintFaces(geometry, radius, angles, colors, topDown) {
2393
+ // compute threshold values
2394
+ var thresholds = [];
2395
+ var startAngle = topDown === true ? 0 : Math.PI;
2396
+
2397
+ for (var i = 0, l = colors.length; i < l; i++) {
2398
+ var angle = i === 0 ? 0 : angles[i - 1];
2399
+ angle = topDown === true ? angle : startAngle - angle;
2400
+ var point = new _three.Vector3();
2401
+ point.setFromSphericalCoords(radius, angle, 0);
2402
+ thresholds.push(point);
2403
+ } // generate vertex colors
2404
+
2405
+
2406
+ var indices = geometry.index;
2407
+ var positionAttribute = geometry.attributes.position;
2408
+ var colorAttribute = new _three.BufferAttribute(new Float32Array(geometry.attributes.position.count * 3), 3);
2409
+ var position = new _three.Vector3();
2410
+ var color = new _three.Color();
2411
+
2412
+ for (var _i20 = 0; _i20 < indices.count; _i20++) {
2413
+ var index = indices.getX(_i20);
2414
+ position.fromBufferAttribute(positionAttribute, index);
2415
+ var thresholdIndexA = void 0,
2416
+ thresholdIndexB = void 0;
2417
+ var t = 1;
2418
+
2419
+ for (var j = 1; j < thresholds.length; j++) {
2420
+ thresholdIndexA = j - 1;
2421
+ thresholdIndexB = j;
2422
+ var thresholdA = thresholds[thresholdIndexA];
2423
+ var thresholdB = thresholds[thresholdIndexB];
2424
+
2425
+ if (topDown === true) {
2426
+ // interpolation for sky color
2427
+ if (position.y <= thresholdA.y && position.y > thresholdB.y) {
2428
+ t = Math.abs(thresholdA.y - position.y) / Math.abs(thresholdA.y - thresholdB.y);
2429
+ break;
2430
+ }
2431
+ } else {
2432
+ // interpolation for ground color
2433
+ if (position.y >= thresholdA.y && position.y < thresholdB.y) {
2434
+ t = Math.abs(thresholdA.y - position.y) / Math.abs(thresholdA.y - thresholdB.y);
2435
+ break;
2436
+ }
2437
+ }
2438
+ }
2439
+
2440
+ var colorA = colors[thresholdIndexA];
2441
+ var colorB = colors[thresholdIndexB];
2442
+ color.copy(colorA).lerp(colorB, t);
2443
+ colorAttribute.setXYZ(index, color.r, color.g, color.b);
2444
+ }
2445
+
2446
+ geometry.setAttribute('color', colorAttribute);
2447
+ } //
2448
+
2449
+
2450
+ var textureLoader = new _three.TextureLoader(this.manager);
2451
+ textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin); // check version (only 2.0 is supported)
2452
+
2453
+ if (data.indexOf('#VRML V2.0') === -1) {
2454
+ throw Error('THREE.VRMLLexer: Version of VRML asset not supported.');
2455
+ } // create JSON representing the tree structure of the VRML asset
2456
+
2457
+
2458
+ var tree = generateVRMLTree(data); // parse the tree structure to a three.js scene
2459
+
2460
+ var scene = parseTree(tree);
2461
+ return scene;
2462
+ }
2463
+ }]);
2464
+
2465
+ return VRMLLoader;
2466
+ }(_three.Loader);
2467
+
2468
+ _exports.VRMLLoader = VRMLLoader;
2469
+
2470
+ var VRMLLexer = /*#__PURE__*/function () {
2471
+ function VRMLLexer(tokens) {
2472
+ _classCallCheck(this, VRMLLexer);
2473
+
2474
+ this.lexer = new _chevrotainModuleMin.default.Lexer(tokens); // eslint-disable-line no-undef
2475
+ }
2476
+
2477
+ _createClass(VRMLLexer, [{
2478
+ key: "lex",
2479
+ value: function lex(inputText) {
2480
+ var lexingResult = this.lexer.tokenize(inputText);
2481
+
2482
+ if (lexingResult.errors.length > 0) {
2483
+ console.error(lexingResult.errors);
2484
+ throw Error('THREE.VRMLLexer: Lexing errors detected.');
2485
+ }
2486
+
2487
+ return lexingResult;
2488
+ }
2489
+ }]);
2490
+
2491
+ return VRMLLexer;
2492
+ }();
2493
+
2494
+ var CstParser = _chevrotainModuleMin.default.CstParser; // eslint-disable-line no-undef
2495
+
2496
+ var VRMLParser = /*#__PURE__*/function (_CstParser) {
2497
+ _inherits(VRMLParser, _CstParser);
2498
+
2499
+ var _super2 = _createSuper(VRMLParser);
2500
+
2501
+ function VRMLParser(tokenVocabulary) {
2502
+ var _this2;
2503
+
2504
+ _classCallCheck(this, VRMLParser);
2505
+
2506
+ _this2 = _super2.call(this, tokenVocabulary);
2507
+
2508
+ var $ = _assertThisInitialized(_this2);
2509
+
2510
+ var Version = tokenVocabulary['Version'];
2511
+ var LCurly = tokenVocabulary['LCurly'];
2512
+ var RCurly = tokenVocabulary['RCurly'];
2513
+ var LSquare = tokenVocabulary['LSquare'];
2514
+ var RSquare = tokenVocabulary['RSquare'];
2515
+ var Identifier = tokenVocabulary['Identifier'];
2516
+ var RouteIdentifier = tokenVocabulary['RouteIdentifier'];
2517
+ var StringLiteral = tokenVocabulary['StringLiteral'];
2518
+ var HexLiteral = tokenVocabulary['HexLiteral'];
2519
+ var NumberLiteral = tokenVocabulary['NumberLiteral'];
2520
+ var TrueLiteral = tokenVocabulary['TrueLiteral'];
2521
+ var FalseLiteral = tokenVocabulary['FalseLiteral'];
2522
+ var NullLiteral = tokenVocabulary['NullLiteral'];
2523
+ var DEF = tokenVocabulary['DEF'];
2524
+ var USE = tokenVocabulary['USE'];
2525
+ var ROUTE = tokenVocabulary['ROUTE'];
2526
+ var TO = tokenVocabulary['TO'];
2527
+ var NodeName = tokenVocabulary['NodeName'];
2528
+ $.RULE('vrml', function () {
2529
+ $.SUBRULE($.version);
2530
+ $.AT_LEAST_ONE(function () {
2531
+ $.SUBRULE($.node);
2532
+ });
2533
+ $.MANY(function () {
2534
+ $.SUBRULE($.route);
2535
+ });
2536
+ });
2537
+ $.RULE('version', function () {
2538
+ $.CONSUME(Version);
2539
+ });
2540
+ $.RULE('node', function () {
2541
+ $.OPTION(function () {
2542
+ $.SUBRULE($.def);
2543
+ });
2544
+ $.CONSUME(NodeName);
2545
+ $.CONSUME(LCurly);
2546
+ $.MANY(function () {
2547
+ $.SUBRULE($.field);
2548
+ });
2549
+ $.CONSUME(RCurly);
2550
+ });
2551
+ $.RULE('field', function () {
2552
+ $.CONSUME(Identifier);
2553
+ $.OR2([{
2554
+ ALT: function ALT() {
2555
+ $.SUBRULE($.singleFieldValue);
2556
+ }
2557
+ }, {
2558
+ ALT: function ALT() {
2559
+ $.SUBRULE($.multiFieldValue);
2560
+ }
2561
+ }]);
2562
+ });
2563
+ $.RULE('def', function () {
2564
+ $.CONSUME(DEF);
2565
+ $.OR([{
2566
+ ALT: function ALT() {
2567
+ $.CONSUME(Identifier);
2568
+ }
2569
+ }, {
2570
+ ALT: function ALT() {
2571
+ $.CONSUME(NodeName);
2572
+ }
2573
+ }]);
2574
+ });
2575
+ $.RULE('use', function () {
2576
+ $.CONSUME(USE);
2577
+ $.OR([{
2578
+ ALT: function ALT() {
2579
+ $.CONSUME(Identifier);
2580
+ }
2581
+ }, {
2582
+ ALT: function ALT() {
2583
+ $.CONSUME(NodeName);
2584
+ }
2585
+ }]);
2586
+ });
2587
+ $.RULE('singleFieldValue', function () {
2588
+ $.AT_LEAST_ONE(function () {
2589
+ $.OR([{
2590
+ ALT: function ALT() {
2591
+ $.SUBRULE($.node);
2592
+ }
2593
+ }, {
2594
+ ALT: function ALT() {
2595
+ $.SUBRULE($.use);
2596
+ }
2597
+ }, {
2598
+ ALT: function ALT() {
2599
+ $.CONSUME(StringLiteral);
2600
+ }
2601
+ }, {
2602
+ ALT: function ALT() {
2603
+ $.CONSUME(HexLiteral);
2604
+ }
2605
+ }, {
2606
+ ALT: function ALT() {
2607
+ $.CONSUME(NumberLiteral);
2608
+ }
2609
+ }, {
2610
+ ALT: function ALT() {
2611
+ $.CONSUME(TrueLiteral);
2612
+ }
2613
+ }, {
2614
+ ALT: function ALT() {
2615
+ $.CONSUME(FalseLiteral);
2616
+ }
2617
+ }, {
2618
+ ALT: function ALT() {
2619
+ $.CONSUME(NullLiteral);
2620
+ }
2621
+ }]);
2622
+ });
2623
+ });
2624
+ $.RULE('multiFieldValue', function () {
2625
+ $.CONSUME(LSquare);
2626
+ $.MANY(function () {
2627
+ $.OR([{
2628
+ ALT: function ALT() {
2629
+ $.SUBRULE($.node);
2630
+ }
2631
+ }, {
2632
+ ALT: function ALT() {
2633
+ $.SUBRULE($.use);
2634
+ }
2635
+ }, {
2636
+ ALT: function ALT() {
2637
+ $.CONSUME(StringLiteral);
2638
+ }
2639
+ }, {
2640
+ ALT: function ALT() {
2641
+ $.CONSUME(HexLiteral);
2642
+ }
2643
+ }, {
2644
+ ALT: function ALT() {
2645
+ $.CONSUME(NumberLiteral);
2646
+ }
2647
+ }, {
2648
+ ALT: function ALT() {
2649
+ $.CONSUME(NullLiteral);
2650
+ }
2651
+ }]);
2652
+ });
2653
+ $.CONSUME(RSquare);
2654
+ });
2655
+ $.RULE('route', function () {
2656
+ $.CONSUME(ROUTE);
2657
+ $.CONSUME(RouteIdentifier);
2658
+ $.CONSUME(TO);
2659
+ $.CONSUME2(RouteIdentifier);
2660
+ });
2661
+
2662
+ _this2.performSelfAnalysis();
2663
+
2664
+ return _this2;
2665
+ }
2666
+
2667
+ return _createClass(VRMLParser);
2668
+ }(CstParser);
2669
+
2670
+ var Face = /*#__PURE__*/_createClass(function Face(a, b, c) {
2671
+ _classCallCheck(this, Face);
2672
+
2673
+ this.a = a;
2674
+ this.b = b;
2675
+ this.c = c;
2676
+ this.normal = new _three.Vector3();
2677
+ });
2678
+
2679
+ var TEXTURE_TYPE = {
2680
+ INTENSITY: 1,
2681
+ INTENSITY_ALPHA: 2,
2682
+ RGB: 3,
2683
+ RGBA: 4
2684
+ };
2685
+ });