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,1123 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "three", "../libs/fflate.module.js"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("three"), require("../libs/fflate.module.js"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.three, global.fflateModule);
11
+ global.MFLoader = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, fflate) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.ThreeMFLoader = void 0;
20
+ fflate = _interopRequireWildcard(fflate);
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+
28
+ 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); } }
29
+
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
+
32
+ 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); }
33
+
34
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
+
36
+ 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); }; }
37
+
38
+ 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); }
39
+
40
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
+
42
+ 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; } }
43
+
44
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
+
46
+ /**
47
+ *
48
+ * 3D Manufacturing Format (3MF) specification: https://3mf.io/specification/
49
+ *
50
+ * The following features from the core specification are supported:
51
+ *
52
+ * - 3D Models
53
+ * - Object Resources (Meshes and Components)
54
+ * - Material Resources (Base Materials)
55
+ *
56
+ * 3MF Materials and Properties Extension are only partially supported.
57
+ *
58
+ * - Texture 2D
59
+ * - Texture 2D Groups
60
+ * - Color Groups (Vertex Colors)
61
+ * - Metallic Display Properties (PBR)
62
+ */
63
+ var ThreeMFLoader = /*#__PURE__*/function (_Loader) {
64
+ _inherits(ThreeMFLoader, _Loader);
65
+
66
+ var _super = _createSuper(ThreeMFLoader);
67
+
68
+ function ThreeMFLoader(manager) {
69
+ var _this;
70
+
71
+ _classCallCheck(this, ThreeMFLoader);
72
+
73
+ _this = _super.call(this, manager);
74
+ _this.availableExtensions = [];
75
+ return _this;
76
+ }
77
+
78
+ _createClass(ThreeMFLoader, [{
79
+ key: "load",
80
+ value: function load(url, onLoad, onProgress, onError) {
81
+ var scope = this;
82
+ var loader = new _three.FileLoader(scope.manager);
83
+ loader.setPath(scope.path);
84
+ loader.setResponseType('arraybuffer');
85
+ loader.setRequestHeader(scope.requestHeader);
86
+ loader.setWithCredentials(scope.withCredentials);
87
+ loader.load(url, function (buffer) {
88
+ try {
89
+ onLoad(scope.parse(buffer));
90
+ } catch (e) {
91
+ if (onError) {
92
+ onError(e);
93
+ } else {
94
+ console.error(e);
95
+ }
96
+
97
+ scope.manager.itemError(url);
98
+ }
99
+ }, onProgress, onError);
100
+ }
101
+ }, {
102
+ key: "parse",
103
+ value: function parse(data) {
104
+ var scope = this;
105
+ var textureLoader = new _three.TextureLoader(this.manager);
106
+
107
+ function loadDocument(data) {
108
+ var zip = null;
109
+ var file = null;
110
+ var relsName;
111
+ var modelRelsName;
112
+ var modelPartNames = [];
113
+ var printTicketPartNames = [];
114
+ var texturesPartNames = [];
115
+ var otherPartNames = [];
116
+ var modelRels;
117
+ var modelParts = {};
118
+ var printTicketParts = {};
119
+ var texturesParts = {};
120
+ var otherParts = {};
121
+
122
+ try {
123
+ zip = fflate.unzipSync(new Uint8Array(data)); // eslint-disable-line no-undef
124
+ } catch (e) {
125
+ if (e instanceof ReferenceError) {
126
+ console.error('THREE.3MFLoader: fflate missing and file is compressed.');
127
+ return null;
128
+ }
129
+ }
130
+
131
+ for (file in zip) {
132
+ if (file.match(/\_rels\/.rels$/)) {
133
+ relsName = file;
134
+ } else if (file.match(/3D\/_rels\/.*\.model\.rels$/)) {
135
+ modelRelsName = file;
136
+ } else if (file.match(/^3D\/.*\.model$/)) {
137
+ modelPartNames.push(file);
138
+ } else if (file.match(/^3D\/Metadata\/.*\.xml$/)) {
139
+ printTicketPartNames.push(file);
140
+ } else if (file.match(/^3D\/Textures?\/.*/)) {
141
+ texturesPartNames.push(file);
142
+ } else if (file.match(/^3D\/Other\/.*/)) {
143
+ otherPartNames.push(file);
144
+ }
145
+ } //
146
+
147
+
148
+ var relsView = zip[relsName];
149
+
150
+ var relsFileText = _three.LoaderUtils.decodeText(relsView);
151
+
152
+ var rels = parseRelsXml(relsFileText); //
153
+
154
+ if (modelRelsName) {
155
+ var _relsView = zip[modelRelsName];
156
+
157
+ var _relsFileText = _three.LoaderUtils.decodeText(_relsView);
158
+
159
+ modelRels = parseRelsXml(_relsFileText);
160
+ } //
161
+
162
+
163
+ for (var i = 0; i < modelPartNames.length; i++) {
164
+ var modelPart = modelPartNames[i];
165
+ var view = zip[modelPart];
166
+
167
+ var fileText = _three.LoaderUtils.decodeText(view);
168
+
169
+ var xmlData = new DOMParser().parseFromString(fileText, 'application/xml');
170
+
171
+ if (xmlData.documentElement.nodeName.toLowerCase() !== 'model') {
172
+ console.error('THREE.3MFLoader: Error loading 3MF - no 3MF document found: ', modelPart);
173
+ }
174
+
175
+ var modelNode = xmlData.querySelector('model');
176
+ var extensions = {};
177
+
178
+ for (var _i = 0; _i < modelNode.attributes.length; _i++) {
179
+ var attr = modelNode.attributes[_i];
180
+
181
+ if (attr.name.match(/^xmlns:(.+)$/)) {
182
+ extensions[attr.value] = RegExp.$1;
183
+ }
184
+ }
185
+
186
+ var modelData = parseModelNode(modelNode);
187
+ modelData['xml'] = modelNode;
188
+
189
+ if (0 < Object.keys(extensions).length) {
190
+ modelData['extensions'] = extensions;
191
+ }
192
+
193
+ modelParts[modelPart] = modelData;
194
+ } //
195
+
196
+
197
+ for (var _i2 = 0; _i2 < texturesPartNames.length; _i2++) {
198
+ var texturesPartName = texturesPartNames[_i2];
199
+ texturesParts[texturesPartName] = zip[texturesPartName].buffer;
200
+ }
201
+
202
+ return {
203
+ rels: rels,
204
+ modelRels: modelRels,
205
+ model: modelParts,
206
+ printTicket: printTicketParts,
207
+ texture: texturesParts,
208
+ other: otherParts
209
+ };
210
+ }
211
+
212
+ function parseRelsXml(relsFileText) {
213
+ var relationships = [];
214
+ var relsXmlData = new DOMParser().parseFromString(relsFileText, 'application/xml');
215
+ var relsNodes = relsXmlData.querySelectorAll('Relationship');
216
+
217
+ for (var i = 0; i < relsNodes.length; i++) {
218
+ var relsNode = relsNodes[i];
219
+ var relationship = {
220
+ target: relsNode.getAttribute('Target'),
221
+ //required
222
+ id: relsNode.getAttribute('Id'),
223
+ //required
224
+ type: relsNode.getAttribute('Type') //required
225
+
226
+ };
227
+ relationships.push(relationship);
228
+ }
229
+
230
+ return relationships;
231
+ }
232
+
233
+ function parseMetadataNodes(metadataNodes) {
234
+ var metadataData = {};
235
+
236
+ for (var i = 0; i < metadataNodes.length; i++) {
237
+ var metadataNode = metadataNodes[i];
238
+ var name = metadataNode.getAttribute('name');
239
+ var validNames = ['Title', 'Designer', 'Description', 'Copyright', 'LicenseTerms', 'Rating', 'CreationDate', 'ModificationDate'];
240
+
241
+ if (0 <= validNames.indexOf(name)) {
242
+ metadataData[name] = metadataNode.textContent;
243
+ }
244
+ }
245
+
246
+ return metadataData;
247
+ }
248
+
249
+ function parseBasematerialsNode(basematerialsNode) {
250
+ var basematerialsData = {
251
+ id: basematerialsNode.getAttribute('id'),
252
+ // required
253
+ basematerials: []
254
+ };
255
+ var basematerialNodes = basematerialsNode.querySelectorAll('base');
256
+
257
+ for (var i = 0; i < basematerialNodes.length; i++) {
258
+ var basematerialNode = basematerialNodes[i];
259
+ var basematerialData = parseBasematerialNode(basematerialNode);
260
+ basematerialData.index = i; // the order and count of the material nodes form an implicit 0-based index
261
+
262
+ basematerialsData.basematerials.push(basematerialData);
263
+ }
264
+
265
+ return basematerialsData;
266
+ }
267
+
268
+ function parseTexture2DNode(texture2DNode) {
269
+ var texture2dData = {
270
+ id: texture2DNode.getAttribute('id'),
271
+ // required
272
+ path: texture2DNode.getAttribute('path'),
273
+ // required
274
+ contenttype: texture2DNode.getAttribute('contenttype'),
275
+ // required
276
+ tilestyleu: texture2DNode.getAttribute('tilestyleu'),
277
+ tilestylev: texture2DNode.getAttribute('tilestylev'),
278
+ filter: texture2DNode.getAttribute('filter')
279
+ };
280
+ return texture2dData;
281
+ }
282
+
283
+ function parseTextures2DGroupNode(texture2DGroupNode) {
284
+ var texture2DGroupData = {
285
+ id: texture2DGroupNode.getAttribute('id'),
286
+ // required
287
+ texid: texture2DGroupNode.getAttribute('texid'),
288
+ // required
289
+ displaypropertiesid: texture2DGroupNode.getAttribute('displaypropertiesid')
290
+ };
291
+ var tex2coordNodes = texture2DGroupNode.querySelectorAll('tex2coord');
292
+ var uvs = [];
293
+
294
+ for (var i = 0; i < tex2coordNodes.length; i++) {
295
+ var tex2coordNode = tex2coordNodes[i];
296
+ var u = tex2coordNode.getAttribute('u');
297
+ var v = tex2coordNode.getAttribute('v');
298
+ uvs.push(parseFloat(u), parseFloat(v));
299
+ }
300
+
301
+ texture2DGroupData['uvs'] = new Float32Array(uvs);
302
+ return texture2DGroupData;
303
+ }
304
+
305
+ function parseColorGroupNode(colorGroupNode) {
306
+ var colorGroupData = {
307
+ id: colorGroupNode.getAttribute('id'),
308
+ // required
309
+ displaypropertiesid: colorGroupNode.getAttribute('displaypropertiesid')
310
+ };
311
+ var colorNodes = colorGroupNode.querySelectorAll('color');
312
+ var colors = [];
313
+ var colorObject = new _three.Color();
314
+
315
+ for (var i = 0; i < colorNodes.length; i++) {
316
+ var colorNode = colorNodes[i];
317
+ var color = colorNode.getAttribute('color');
318
+ colorObject.setStyle(color.substring(0, 7));
319
+ colorObject.convertSRGBToLinear(); // color is in sRGB
320
+
321
+ colors.push(colorObject.r, colorObject.g, colorObject.b);
322
+ }
323
+
324
+ colorGroupData['colors'] = new Float32Array(colors);
325
+ return colorGroupData;
326
+ }
327
+
328
+ function parseMetallicDisplaypropertiesNode(metallicDisplaypropetiesNode) {
329
+ var metallicDisplaypropertiesData = {
330
+ id: metallicDisplaypropetiesNode.getAttribute('id') // required
331
+
332
+ };
333
+ var metallicNodes = metallicDisplaypropetiesNode.querySelectorAll('pbmetallic');
334
+ var metallicData = [];
335
+
336
+ for (var i = 0; i < metallicNodes.length; i++) {
337
+ var metallicNode = metallicNodes[i];
338
+ metallicData.push({
339
+ name: metallicNode.getAttribute('name'),
340
+ // required
341
+ metallicness: parseFloat(metallicNode.getAttribute('metallicness')),
342
+ // required
343
+ roughness: parseFloat(metallicNode.getAttribute('roughness')) // required
344
+
345
+ });
346
+ }
347
+
348
+ metallicDisplaypropertiesData.data = metallicData;
349
+ return metallicDisplaypropertiesData;
350
+ }
351
+
352
+ function parseBasematerialNode(basematerialNode) {
353
+ var basematerialData = {};
354
+ basematerialData['name'] = basematerialNode.getAttribute('name'); // required
355
+
356
+ basematerialData['displaycolor'] = basematerialNode.getAttribute('displaycolor'); // required
357
+
358
+ basematerialData['displaypropertiesid'] = basematerialNode.getAttribute('displaypropertiesid');
359
+ return basematerialData;
360
+ }
361
+
362
+ function parseMeshNode(meshNode) {
363
+ var meshData = {};
364
+ var vertices = [];
365
+ var vertexNodes = meshNode.querySelectorAll('vertices vertex');
366
+
367
+ for (var i = 0; i < vertexNodes.length; i++) {
368
+ var vertexNode = vertexNodes[i];
369
+ var x = vertexNode.getAttribute('x');
370
+ var y = vertexNode.getAttribute('y');
371
+ var z = vertexNode.getAttribute('z');
372
+ vertices.push(parseFloat(x), parseFloat(y), parseFloat(z));
373
+ }
374
+
375
+ meshData['vertices'] = new Float32Array(vertices);
376
+ var triangleProperties = [];
377
+ var triangles = [];
378
+ var triangleNodes = meshNode.querySelectorAll('triangles triangle');
379
+
380
+ for (var _i3 = 0; _i3 < triangleNodes.length; _i3++) {
381
+ var triangleNode = triangleNodes[_i3];
382
+ var v1 = triangleNode.getAttribute('v1');
383
+ var v2 = triangleNode.getAttribute('v2');
384
+ var v3 = triangleNode.getAttribute('v3');
385
+ var p1 = triangleNode.getAttribute('p1');
386
+ var p2 = triangleNode.getAttribute('p2');
387
+ var p3 = triangleNode.getAttribute('p3');
388
+ var pid = triangleNode.getAttribute('pid');
389
+ var triangleProperty = {};
390
+ triangleProperty['v1'] = parseInt(v1, 10);
391
+ triangleProperty['v2'] = parseInt(v2, 10);
392
+ triangleProperty['v3'] = parseInt(v3, 10);
393
+ triangles.push(triangleProperty['v1'], triangleProperty['v2'], triangleProperty['v3']); // optional
394
+
395
+ if (p1) {
396
+ triangleProperty['p1'] = parseInt(p1, 10);
397
+ }
398
+
399
+ if (p2) {
400
+ triangleProperty['p2'] = parseInt(p2, 10);
401
+ }
402
+
403
+ if (p3) {
404
+ triangleProperty['p3'] = parseInt(p3, 10);
405
+ }
406
+
407
+ if (pid) {
408
+ triangleProperty['pid'] = pid;
409
+ }
410
+
411
+ if (0 < Object.keys(triangleProperty).length) {
412
+ triangleProperties.push(triangleProperty);
413
+ }
414
+ }
415
+
416
+ meshData['triangleProperties'] = triangleProperties;
417
+ meshData['triangles'] = new Uint32Array(triangles);
418
+ return meshData;
419
+ }
420
+
421
+ function parseComponentsNode(componentsNode) {
422
+ var components = [];
423
+ var componentNodes = componentsNode.querySelectorAll('component');
424
+
425
+ for (var i = 0; i < componentNodes.length; i++) {
426
+ var componentNode = componentNodes[i];
427
+ var componentData = parseComponentNode(componentNode);
428
+ components.push(componentData);
429
+ }
430
+
431
+ return components;
432
+ }
433
+
434
+ function parseComponentNode(componentNode) {
435
+ var componentData = {};
436
+ componentData['objectId'] = componentNode.getAttribute('objectid'); // required
437
+
438
+ var transform = componentNode.getAttribute('transform');
439
+
440
+ if (transform) {
441
+ componentData['transform'] = parseTransform(transform);
442
+ }
443
+
444
+ return componentData;
445
+ }
446
+
447
+ function parseTransform(transform) {
448
+ var t = [];
449
+ transform.split(' ').forEach(function (s) {
450
+ t.push(parseFloat(s));
451
+ });
452
+ var matrix = new _three.Matrix4();
453
+ matrix.set(t[0], t[3], t[6], t[9], t[1], t[4], t[7], t[10], t[2], t[5], t[8], t[11], 0.0, 0.0, 0.0, 1.0);
454
+ return matrix;
455
+ }
456
+
457
+ function parseObjectNode(objectNode) {
458
+ var objectData = {
459
+ type: objectNode.getAttribute('type')
460
+ };
461
+ var id = objectNode.getAttribute('id');
462
+
463
+ if (id) {
464
+ objectData['id'] = id;
465
+ }
466
+
467
+ var pid = objectNode.getAttribute('pid');
468
+
469
+ if (pid) {
470
+ objectData['pid'] = pid;
471
+ }
472
+
473
+ var pindex = objectNode.getAttribute('pindex');
474
+
475
+ if (pindex) {
476
+ objectData['pindex'] = pindex;
477
+ }
478
+
479
+ var thumbnail = objectNode.getAttribute('thumbnail');
480
+
481
+ if (thumbnail) {
482
+ objectData['thumbnail'] = thumbnail;
483
+ }
484
+
485
+ var partnumber = objectNode.getAttribute('partnumber');
486
+
487
+ if (partnumber) {
488
+ objectData['partnumber'] = partnumber;
489
+ }
490
+
491
+ var name = objectNode.getAttribute('name');
492
+
493
+ if (name) {
494
+ objectData['name'] = name;
495
+ }
496
+
497
+ var meshNode = objectNode.querySelector('mesh');
498
+
499
+ if (meshNode) {
500
+ objectData['mesh'] = parseMeshNode(meshNode);
501
+ }
502
+
503
+ var componentsNode = objectNode.querySelector('components');
504
+
505
+ if (componentsNode) {
506
+ objectData['components'] = parseComponentsNode(componentsNode);
507
+ }
508
+
509
+ return objectData;
510
+ }
511
+
512
+ function parseResourcesNode(resourcesNode) {
513
+ var resourcesData = {};
514
+ resourcesData['basematerials'] = {};
515
+ var basematerialsNodes = resourcesNode.querySelectorAll('basematerials');
516
+
517
+ for (var i = 0; i < basematerialsNodes.length; i++) {
518
+ var basematerialsNode = basematerialsNodes[i];
519
+ var basematerialsData = parseBasematerialsNode(basematerialsNode);
520
+ resourcesData['basematerials'][basematerialsData['id']] = basematerialsData;
521
+ } //
522
+
523
+
524
+ resourcesData['texture2d'] = {};
525
+ var textures2DNodes = resourcesNode.querySelectorAll('texture2d');
526
+
527
+ for (var _i4 = 0; _i4 < textures2DNodes.length; _i4++) {
528
+ var textures2DNode = textures2DNodes[_i4];
529
+ var texture2DData = parseTexture2DNode(textures2DNode);
530
+ resourcesData['texture2d'][texture2DData['id']] = texture2DData;
531
+ } //
532
+
533
+
534
+ resourcesData['colorgroup'] = {};
535
+ var colorGroupNodes = resourcesNode.querySelectorAll('colorgroup');
536
+
537
+ for (var _i5 = 0; _i5 < colorGroupNodes.length; _i5++) {
538
+ var colorGroupNode = colorGroupNodes[_i5];
539
+ var colorGroupData = parseColorGroupNode(colorGroupNode);
540
+ resourcesData['colorgroup'][colorGroupData['id']] = colorGroupData;
541
+ } //
542
+
543
+
544
+ resourcesData['pbmetallicdisplayproperties'] = {};
545
+ var pbmetallicdisplaypropertiesNodes = resourcesNode.querySelectorAll('pbmetallicdisplayproperties');
546
+
547
+ for (var _i6 = 0; _i6 < pbmetallicdisplaypropertiesNodes.length; _i6++) {
548
+ var pbmetallicdisplaypropertiesNode = pbmetallicdisplaypropertiesNodes[_i6];
549
+ var pbmetallicdisplaypropertiesData = parseMetallicDisplaypropertiesNode(pbmetallicdisplaypropertiesNode);
550
+ resourcesData['pbmetallicdisplayproperties'][pbmetallicdisplaypropertiesData['id']] = pbmetallicdisplaypropertiesData;
551
+ } //
552
+
553
+
554
+ resourcesData['texture2dgroup'] = {};
555
+ var textures2DGroupNodes = resourcesNode.querySelectorAll('texture2dgroup');
556
+
557
+ for (var _i7 = 0; _i7 < textures2DGroupNodes.length; _i7++) {
558
+ var textures2DGroupNode = textures2DGroupNodes[_i7];
559
+ var textures2DGroupData = parseTextures2DGroupNode(textures2DGroupNode);
560
+ resourcesData['texture2dgroup'][textures2DGroupData['id']] = textures2DGroupData;
561
+ } //
562
+
563
+
564
+ resourcesData['object'] = {};
565
+ var objectNodes = resourcesNode.querySelectorAll('object');
566
+
567
+ for (var _i8 = 0; _i8 < objectNodes.length; _i8++) {
568
+ var objectNode = objectNodes[_i8];
569
+ var objectData = parseObjectNode(objectNode);
570
+ resourcesData['object'][objectData['id']] = objectData;
571
+ }
572
+
573
+ return resourcesData;
574
+ }
575
+
576
+ function parseBuildNode(buildNode) {
577
+ var buildData = [];
578
+ var itemNodes = buildNode.querySelectorAll('item');
579
+
580
+ for (var i = 0; i < itemNodes.length; i++) {
581
+ var itemNode = itemNodes[i];
582
+ var buildItem = {
583
+ objectId: itemNode.getAttribute('objectid')
584
+ };
585
+ var transform = itemNode.getAttribute('transform');
586
+
587
+ if (transform) {
588
+ buildItem['transform'] = parseTransform(transform);
589
+ }
590
+
591
+ buildData.push(buildItem);
592
+ }
593
+
594
+ return buildData;
595
+ }
596
+
597
+ function parseModelNode(modelNode) {
598
+ var modelData = {
599
+ unit: modelNode.getAttribute('unit') || 'millimeter'
600
+ };
601
+ var metadataNodes = modelNode.querySelectorAll('metadata');
602
+
603
+ if (metadataNodes) {
604
+ modelData['metadata'] = parseMetadataNodes(metadataNodes);
605
+ }
606
+
607
+ var resourcesNode = modelNode.querySelector('resources');
608
+
609
+ if (resourcesNode) {
610
+ modelData['resources'] = parseResourcesNode(resourcesNode);
611
+ }
612
+
613
+ var buildNode = modelNode.querySelector('build');
614
+
615
+ if (buildNode) {
616
+ modelData['build'] = parseBuildNode(buildNode);
617
+ }
618
+
619
+ return modelData;
620
+ }
621
+
622
+ function buildTexture(texture2dgroup, objects, modelData, textureData) {
623
+ var texid = texture2dgroup.texid;
624
+ var texture2ds = modelData.resources.texture2d;
625
+ var texture2d = texture2ds[texid];
626
+
627
+ if (texture2d) {
628
+ var _data = textureData[texture2d.path];
629
+ var type = texture2d.contenttype;
630
+ var blob = new Blob([_data], {
631
+ type: type
632
+ });
633
+ var sourceURI = URL.createObjectURL(blob);
634
+ var texture = textureLoader.load(sourceURI, function () {
635
+ URL.revokeObjectURL(sourceURI);
636
+ });
637
+ texture.encoding = _three.sRGBEncoding; // texture parameters
638
+
639
+ switch (texture2d.tilestyleu) {
640
+ case 'wrap':
641
+ texture.wrapS = _three.RepeatWrapping;
642
+ break;
643
+
644
+ case 'mirror':
645
+ texture.wrapS = _three.MirroredRepeatWrapping;
646
+ break;
647
+
648
+ case 'none':
649
+ case 'clamp':
650
+ texture.wrapS = _three.ClampToEdgeWrapping;
651
+ break;
652
+
653
+ default:
654
+ texture.wrapS = _three.RepeatWrapping;
655
+ }
656
+
657
+ switch (texture2d.tilestylev) {
658
+ case 'wrap':
659
+ texture.wrapT = _three.RepeatWrapping;
660
+ break;
661
+
662
+ case 'mirror':
663
+ texture.wrapT = _three.MirroredRepeatWrapping;
664
+ break;
665
+
666
+ case 'none':
667
+ case 'clamp':
668
+ texture.wrapT = _three.ClampToEdgeWrapping;
669
+ break;
670
+
671
+ default:
672
+ texture.wrapT = _three.RepeatWrapping;
673
+ }
674
+
675
+ switch (texture2d.filter) {
676
+ case 'auto':
677
+ texture.magFilter = _three.LinearFilter;
678
+ texture.minFilter = _three.LinearMipmapLinearFilter;
679
+ break;
680
+
681
+ case 'linear':
682
+ texture.magFilter = _three.LinearFilter;
683
+ texture.minFilter = _three.LinearFilter;
684
+ break;
685
+
686
+ case 'nearest':
687
+ texture.magFilter = _three.NearestFilter;
688
+ texture.minFilter = _three.NearestFilter;
689
+ break;
690
+
691
+ default:
692
+ texture.magFilter = _three.LinearFilter;
693
+ texture.minFilter = _three.LinearMipmapLinearFilter;
694
+ }
695
+
696
+ return texture;
697
+ } else {
698
+ return null;
699
+ }
700
+ }
701
+
702
+ function buildBasematerialsMeshes(basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData) {
703
+ var objectPindex = objectData.pindex;
704
+ var materialMap = {};
705
+
706
+ for (var i = 0, l = triangleProperties.length; i < l; i++) {
707
+ var triangleProperty = triangleProperties[i];
708
+ var pindex = triangleProperty.p1 !== undefined ? triangleProperty.p1 : objectPindex;
709
+ if (materialMap[pindex] === undefined) materialMap[pindex] = [];
710
+ materialMap[pindex].push(triangleProperty);
711
+ } //
712
+
713
+
714
+ var keys = Object.keys(materialMap);
715
+ var meshes = [];
716
+
717
+ for (var _i9 = 0, _l = keys.length; _i9 < _l; _i9++) {
718
+ var materialIndex = keys[_i9];
719
+ var trianglePropertiesProps = materialMap[materialIndex];
720
+ var basematerialData = basematerials.basematerials[materialIndex];
721
+ var material = getBuild(basematerialData, objects, modelData, textureData, objectData, buildBasematerial); //
722
+
723
+ var geometry = new _three.BufferGeometry();
724
+ var positionData = [];
725
+ var vertices = meshData.vertices;
726
+
727
+ for (var j = 0, jl = trianglePropertiesProps.length; j < jl; j++) {
728
+ var _triangleProperty = trianglePropertiesProps[j];
729
+ positionData.push(vertices[_triangleProperty.v1 * 3 + 0]);
730
+ positionData.push(vertices[_triangleProperty.v1 * 3 + 1]);
731
+ positionData.push(vertices[_triangleProperty.v1 * 3 + 2]);
732
+ positionData.push(vertices[_triangleProperty.v2 * 3 + 0]);
733
+ positionData.push(vertices[_triangleProperty.v2 * 3 + 1]);
734
+ positionData.push(vertices[_triangleProperty.v2 * 3 + 2]);
735
+ positionData.push(vertices[_triangleProperty.v3 * 3 + 0]);
736
+ positionData.push(vertices[_triangleProperty.v3 * 3 + 1]);
737
+ positionData.push(vertices[_triangleProperty.v3 * 3 + 2]);
738
+ }
739
+
740
+ geometry.setAttribute('position', new _three.Float32BufferAttribute(positionData, 3)); //
741
+
742
+ var mesh = new _three.Mesh(geometry, material);
743
+ meshes.push(mesh);
744
+ }
745
+
746
+ return meshes;
747
+ }
748
+
749
+ function buildTexturedMesh(texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData) {
750
+ // geometry
751
+ var geometry = new _three.BufferGeometry();
752
+ var positionData = [];
753
+ var uvData = [];
754
+ var vertices = meshData.vertices;
755
+ var uvs = texture2dgroup.uvs;
756
+
757
+ for (var i = 0, l = triangleProperties.length; i < l; i++) {
758
+ var triangleProperty = triangleProperties[i];
759
+ positionData.push(vertices[triangleProperty.v1 * 3 + 0]);
760
+ positionData.push(vertices[triangleProperty.v1 * 3 + 1]);
761
+ positionData.push(vertices[triangleProperty.v1 * 3 + 2]);
762
+ positionData.push(vertices[triangleProperty.v2 * 3 + 0]);
763
+ positionData.push(vertices[triangleProperty.v2 * 3 + 1]);
764
+ positionData.push(vertices[triangleProperty.v2 * 3 + 2]);
765
+ positionData.push(vertices[triangleProperty.v3 * 3 + 0]);
766
+ positionData.push(vertices[triangleProperty.v3 * 3 + 1]);
767
+ positionData.push(vertices[triangleProperty.v3 * 3 + 2]); //
768
+
769
+ uvData.push(uvs[triangleProperty.p1 * 2 + 0]);
770
+ uvData.push(uvs[triangleProperty.p1 * 2 + 1]);
771
+ uvData.push(uvs[triangleProperty.p2 * 2 + 0]);
772
+ uvData.push(uvs[triangleProperty.p2 * 2 + 1]);
773
+ uvData.push(uvs[triangleProperty.p3 * 2 + 0]);
774
+ uvData.push(uvs[triangleProperty.p3 * 2 + 1]);
775
+ }
776
+
777
+ geometry.setAttribute('position', new _three.Float32BufferAttribute(positionData, 3));
778
+ geometry.setAttribute('uv', new _three.Float32BufferAttribute(uvData, 2)); // material
779
+
780
+ var texture = getBuild(texture2dgroup, objects, modelData, textureData, objectData, buildTexture);
781
+ var material = new _three.MeshPhongMaterial({
782
+ map: texture,
783
+ flatShading: true
784
+ }); // mesh
785
+
786
+ var mesh = new _three.Mesh(geometry, material);
787
+ return mesh;
788
+ }
789
+
790
+ function buildVertexColorMesh(colorgroup, triangleProperties, meshData, objects, modelData, objectData) {
791
+ // geometry
792
+ var geometry = new _three.BufferGeometry();
793
+ var positionData = [];
794
+ var colorData = [];
795
+ var vertices = meshData.vertices;
796
+ var colors = colorgroup.colors;
797
+
798
+ for (var i = 0, l = triangleProperties.length; i < l; i++) {
799
+ var triangleProperty = triangleProperties[i];
800
+ var v1 = triangleProperty.v1;
801
+ var v2 = triangleProperty.v2;
802
+ var v3 = triangleProperty.v3;
803
+ positionData.push(vertices[v1 * 3 + 0]);
804
+ positionData.push(vertices[v1 * 3 + 1]);
805
+ positionData.push(vertices[v1 * 3 + 2]);
806
+ positionData.push(vertices[v2 * 3 + 0]);
807
+ positionData.push(vertices[v2 * 3 + 1]);
808
+ positionData.push(vertices[v2 * 3 + 2]);
809
+ positionData.push(vertices[v3 * 3 + 0]);
810
+ positionData.push(vertices[v3 * 3 + 1]);
811
+ positionData.push(vertices[v3 * 3 + 2]); //
812
+
813
+ var p1 = triangleProperty.p1 !== undefined ? triangleProperty.p1 : objectData.pindex;
814
+ var p2 = triangleProperty.p2 !== undefined ? triangleProperty.p2 : p1;
815
+ var p3 = triangleProperty.p3 !== undefined ? triangleProperty.p3 : p1;
816
+ colorData.push(colors[p1 * 3 + 0]);
817
+ colorData.push(colors[p1 * 3 + 1]);
818
+ colorData.push(colors[p1 * 3 + 2]);
819
+ colorData.push(colors[p2 * 3 + 0]);
820
+ colorData.push(colors[p2 * 3 + 1]);
821
+ colorData.push(colors[p2 * 3 + 2]);
822
+ colorData.push(colors[p3 * 3 + 0]);
823
+ colorData.push(colors[p3 * 3 + 1]);
824
+ colorData.push(colors[p3 * 3 + 2]);
825
+ }
826
+
827
+ geometry.setAttribute('position', new _three.Float32BufferAttribute(positionData, 3));
828
+ geometry.setAttribute('color', new _three.Float32BufferAttribute(colorData, 3)); // material
829
+
830
+ var material = new _three.MeshPhongMaterial({
831
+ vertexColors: true,
832
+ flatShading: true
833
+ }); // mesh
834
+
835
+ var mesh = new _three.Mesh(geometry, material);
836
+ return mesh;
837
+ }
838
+
839
+ function buildDefaultMesh(meshData) {
840
+ var geometry = new _three.BufferGeometry();
841
+ geometry.setIndex(new _three.BufferAttribute(meshData['triangles'], 1));
842
+ geometry.setAttribute('position', new _three.BufferAttribute(meshData['vertices'], 3));
843
+ var material = new _three.MeshPhongMaterial({
844
+ color: 0xffffff,
845
+ flatShading: true
846
+ });
847
+ var mesh = new _three.Mesh(geometry, material);
848
+ return mesh;
849
+ }
850
+
851
+ function buildMeshes(resourceMap, meshData, objects, modelData, textureData, objectData) {
852
+ var keys = Object.keys(resourceMap);
853
+ var meshes = [];
854
+
855
+ for (var i = 0, il = keys.length; i < il; i++) {
856
+ var resourceId = keys[i];
857
+ var triangleProperties = resourceMap[resourceId];
858
+ var resourceType = getResourceType(resourceId, modelData);
859
+
860
+ switch (resourceType) {
861
+ case 'material':
862
+ var basematerials = modelData.resources.basematerials[resourceId];
863
+ var newMeshes = buildBasematerialsMeshes(basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData);
864
+
865
+ for (var j = 0, jl = newMeshes.length; j < jl; j++) {
866
+ meshes.push(newMeshes[j]);
867
+ }
868
+
869
+ break;
870
+
871
+ case 'texture':
872
+ var texture2dgroup = modelData.resources.texture2dgroup[resourceId];
873
+ meshes.push(buildTexturedMesh(texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData));
874
+ break;
875
+
876
+ case 'vertexColors':
877
+ var colorgroup = modelData.resources.colorgroup[resourceId];
878
+ meshes.push(buildVertexColorMesh(colorgroup, triangleProperties, meshData, objects, modelData, objectData));
879
+ break;
880
+
881
+ case 'default':
882
+ meshes.push(buildDefaultMesh(meshData));
883
+ break;
884
+
885
+ default:
886
+ console.error('THREE.3MFLoader: Unsupported resource type.');
887
+ }
888
+ }
889
+
890
+ return meshes;
891
+ }
892
+
893
+ function getResourceType(pid, modelData) {
894
+ if (modelData.resources.texture2dgroup[pid] !== undefined) {
895
+ return 'texture';
896
+ } else if (modelData.resources.basematerials[pid] !== undefined) {
897
+ return 'material';
898
+ } else if (modelData.resources.colorgroup[pid] !== undefined) {
899
+ return 'vertexColors';
900
+ } else if (pid === 'default') {
901
+ return 'default';
902
+ } else {
903
+ return undefined;
904
+ }
905
+ }
906
+
907
+ function analyzeObject(modelData, meshData, objectData) {
908
+ var resourceMap = {};
909
+ var triangleProperties = meshData['triangleProperties'];
910
+ var objectPid = objectData.pid;
911
+
912
+ for (var i = 0, l = triangleProperties.length; i < l; i++) {
913
+ var triangleProperty = triangleProperties[i];
914
+ var pid = triangleProperty.pid !== undefined ? triangleProperty.pid : objectPid;
915
+ if (pid === undefined) pid = 'default';
916
+ if (resourceMap[pid] === undefined) resourceMap[pid] = [];
917
+ resourceMap[pid].push(triangleProperty);
918
+ }
919
+
920
+ return resourceMap;
921
+ }
922
+
923
+ function buildGroup(meshData, objects, modelData, textureData, objectData) {
924
+ var group = new _three.Group();
925
+ var resourceMap = analyzeObject(modelData, meshData, objectData);
926
+ var meshes = buildMeshes(resourceMap, meshData, objects, modelData, textureData, objectData);
927
+
928
+ for (var i = 0, l = meshes.length; i < l; i++) {
929
+ group.add(meshes[i]);
930
+ }
931
+
932
+ return group;
933
+ }
934
+
935
+ function applyExtensions(extensions, meshData, modelXml) {
936
+ if (!extensions) {
937
+ return;
938
+ }
939
+
940
+ var availableExtensions = [];
941
+ var keys = Object.keys(extensions);
942
+
943
+ for (var i = 0; i < keys.length; i++) {
944
+ var ns = keys[i];
945
+
946
+ for (var j = 0; j < scope.availableExtensions.length; j++) {
947
+ var extension = scope.availableExtensions[j];
948
+
949
+ if (extension.ns === ns) {
950
+ availableExtensions.push(extension);
951
+ }
952
+ }
953
+ }
954
+
955
+ for (var _i10 = 0; _i10 < availableExtensions.length; _i10++) {
956
+ var _extension = availableExtensions[_i10];
957
+
958
+ _extension.apply(modelXml, extensions[_extension['ns']], meshData);
959
+ }
960
+ }
961
+
962
+ function getBuild(data, objects, modelData, textureData, objectData, builder) {
963
+ if (data.build !== undefined) return data.build;
964
+ data.build = builder(data, objects, modelData, textureData, objectData);
965
+ return data.build;
966
+ }
967
+
968
+ function buildBasematerial(materialData, objects, modelData) {
969
+ var material;
970
+ var displaypropertiesid = materialData.displaypropertiesid;
971
+ var pbmetallicdisplayproperties = modelData.resources.pbmetallicdisplayproperties;
972
+
973
+ if (displaypropertiesid !== null && pbmetallicdisplayproperties[displaypropertiesid] !== undefined) {
974
+ // metallic display property, use StandardMaterial
975
+ var pbmetallicdisplayproperty = pbmetallicdisplayproperties[displaypropertiesid];
976
+ var metallicData = pbmetallicdisplayproperty.data[materialData.index];
977
+ material = new _three.MeshStandardMaterial({
978
+ flatShading: true,
979
+ roughness: metallicData.roughness,
980
+ metalness: metallicData.metallicness
981
+ });
982
+ } else {
983
+ // otherwise use PhongMaterial
984
+ material = new _three.MeshPhongMaterial({
985
+ flatShading: true
986
+ });
987
+ }
988
+
989
+ material.name = materialData.name; // displaycolor MUST be specified with a value of a 6 or 8 digit hexadecimal number, e.g. "#RRGGBB" or "#RRGGBBAA"
990
+
991
+ var displaycolor = materialData.displaycolor;
992
+ var color = displaycolor.substring(0, 7);
993
+ material.color.setStyle(color);
994
+ material.color.convertSRGBToLinear(); // displaycolor is in sRGB
995
+ // process alpha if set
996
+
997
+ if (displaycolor.length === 9) {
998
+ material.opacity = parseInt(displaycolor.charAt(7) + displaycolor.charAt(8), 16) / 255;
999
+ }
1000
+
1001
+ return material;
1002
+ }
1003
+
1004
+ function buildComposite(compositeData, objects, modelData, textureData) {
1005
+ var composite = new _three.Group();
1006
+
1007
+ for (var j = 0; j < compositeData.length; j++) {
1008
+ var component = compositeData[j];
1009
+ var _build = objects[component.objectId];
1010
+
1011
+ if (_build === undefined) {
1012
+ buildObject(component.objectId, objects, modelData, textureData);
1013
+ _build = objects[component.objectId];
1014
+ }
1015
+
1016
+ var object3D = _build.clone(); // apply component transform
1017
+
1018
+
1019
+ var transform = component.transform;
1020
+
1021
+ if (transform) {
1022
+ object3D.applyMatrix4(transform);
1023
+ }
1024
+
1025
+ composite.add(object3D);
1026
+ }
1027
+
1028
+ return composite;
1029
+ }
1030
+
1031
+ function buildObject(objectId, objects, modelData, textureData) {
1032
+ var objectData = modelData['resources']['object'][objectId];
1033
+
1034
+ if (objectData['mesh']) {
1035
+ var meshData = objectData['mesh'];
1036
+ var extensions = modelData['extensions'];
1037
+ var modelXml = modelData['xml'];
1038
+ applyExtensions(extensions, meshData, modelXml);
1039
+ objects[objectData.id] = getBuild(meshData, objects, modelData, textureData, objectData, buildGroup);
1040
+ } else {
1041
+ var compositeData = objectData['components'];
1042
+ objects[objectData.id] = getBuild(compositeData, objects, modelData, textureData, objectData, buildComposite);
1043
+ }
1044
+ }
1045
+
1046
+ function buildObjects(data3mf) {
1047
+ var modelsData = data3mf.model;
1048
+ var modelRels = data3mf.modelRels;
1049
+ var objects = {};
1050
+ var modelsKeys = Object.keys(modelsData);
1051
+ var textureData = {}; // evaluate model relationships to textures
1052
+
1053
+ if (modelRels) {
1054
+ for (var i = 0, l = modelRels.length; i < l; i++) {
1055
+ var modelRel = modelRels[i];
1056
+ var textureKey = modelRel.target.substring(1);
1057
+
1058
+ if (data3mf.texture[textureKey]) {
1059
+ textureData[modelRel.target] = data3mf.texture[textureKey];
1060
+ }
1061
+ }
1062
+ } // start build
1063
+
1064
+
1065
+ for (var _i11 = 0; _i11 < modelsKeys.length; _i11++) {
1066
+ var modelsKey = modelsKeys[_i11];
1067
+ var modelData = modelsData[modelsKey];
1068
+ var objectIds = Object.keys(modelData['resources']['object']);
1069
+
1070
+ for (var j = 0; j < objectIds.length; j++) {
1071
+ var objectId = objectIds[j];
1072
+ buildObject(objectId, objects, modelData, textureData);
1073
+ }
1074
+ }
1075
+
1076
+ return objects;
1077
+ }
1078
+
1079
+ function fetch3DModelPart(rels) {
1080
+ for (var i = 0; i < rels.length; i++) {
1081
+ var rel = rels[i];
1082
+ var extension = rel.target.split('.').pop();
1083
+ if (extension.toLowerCase() === 'model') return rel;
1084
+ }
1085
+ }
1086
+
1087
+ function build(objects, data3mf) {
1088
+ var group = new _three.Group();
1089
+ var relationship = fetch3DModelPart(data3mf['rels']);
1090
+ var buildData = data3mf.model[relationship['target'].substring(1)]['build'];
1091
+
1092
+ for (var i = 0; i < buildData.length; i++) {
1093
+ var buildItem = buildData[i];
1094
+ var object3D = objects[buildItem['objectId']].clone(); // apply transform
1095
+
1096
+ var transform = buildItem['transform'];
1097
+
1098
+ if (transform) {
1099
+ object3D.applyMatrix4(transform);
1100
+ }
1101
+
1102
+ group.add(object3D);
1103
+ }
1104
+
1105
+ return group;
1106
+ }
1107
+
1108
+ var data3mf = loadDocument(data);
1109
+ var objects = buildObjects(data3mf);
1110
+ return build(objects, data3mf);
1111
+ }
1112
+ }, {
1113
+ key: "addExtension",
1114
+ value: function addExtension(extension) {
1115
+ this.availableExtensions.push(extension);
1116
+ }
1117
+ }]);
1118
+
1119
+ return ThreeMFLoader;
1120
+ }(_three.Loader);
1121
+
1122
+ _exports.ThreeMFLoader = ThreeMFLoader;
1123
+ });