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,1373 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "three"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("three"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.three);
11
+ global.Geometry = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.Geometry = _exports.Face3 = void 0;
20
+
21
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
+
23
+ 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); } }
24
+
25
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
26
+
27
+ 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); }
28
+
29
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
+
31
+ 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); }; }
32
+
33
+ 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); }
34
+
35
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
36
+
37
+ 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; } }
38
+
39
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
40
+
41
+ var _m1 = new _three.Matrix4();
42
+
43
+ var _obj = new _three.Object3D();
44
+
45
+ var _offset = new _three.Vector3();
46
+
47
+ var Geometry = /*#__PURE__*/function (_EventDispatcher) {
48
+ _inherits(Geometry, _EventDispatcher);
49
+
50
+ var _super = _createSuper(Geometry);
51
+
52
+ function Geometry() {
53
+ var _this;
54
+
55
+ _classCallCheck(this, Geometry);
56
+
57
+ _this = _super.call(this);
58
+ _this.uuid = _three.MathUtils.generateUUID();
59
+ _this.name = '';
60
+ _this.type = 'Geometry';
61
+ _this.vertices = [];
62
+ _this.colors = [];
63
+ _this.faces = [];
64
+ _this.faceVertexUvs = [[]];
65
+ _this.morphTargets = [];
66
+ _this.morphNormals = [];
67
+ _this.skinWeights = [];
68
+ _this.skinIndices = [];
69
+ _this.lineDistances = [];
70
+ _this.boundingBox = null;
71
+ _this.boundingSphere = null; // update flags
72
+
73
+ _this.elementsNeedUpdate = false;
74
+ _this.verticesNeedUpdate = false;
75
+ _this.uvsNeedUpdate = false;
76
+ _this.normalsNeedUpdate = false;
77
+ _this.colorsNeedUpdate = false;
78
+ _this.lineDistancesNeedUpdate = false;
79
+ _this.groupsNeedUpdate = false;
80
+ return _this;
81
+ }
82
+
83
+ _createClass(Geometry, [{
84
+ key: "applyMatrix4",
85
+ value: function applyMatrix4(matrix) {
86
+ var normalMatrix = new _three.Matrix3().getNormalMatrix(matrix);
87
+
88
+ for (var i = 0, il = this.vertices.length; i < il; i++) {
89
+ var vertex = this.vertices[i];
90
+ vertex.applyMatrix4(matrix);
91
+ }
92
+
93
+ for (var _i = 0, _il = this.faces.length; _i < _il; _i++) {
94
+ var face = this.faces[_i];
95
+ face.normal.applyMatrix3(normalMatrix).normalize();
96
+
97
+ for (var j = 0, jl = face.vertexNormals.length; j < jl; j++) {
98
+ face.vertexNormals[j].applyMatrix3(normalMatrix).normalize();
99
+ }
100
+ }
101
+
102
+ if (this.boundingBox !== null) {
103
+ this.computeBoundingBox();
104
+ }
105
+
106
+ if (this.boundingSphere !== null) {
107
+ this.computeBoundingSphere();
108
+ }
109
+
110
+ this.verticesNeedUpdate = true;
111
+ this.normalsNeedUpdate = true;
112
+ return this;
113
+ }
114
+ }, {
115
+ key: "rotateX",
116
+ value: function rotateX(angle) {
117
+ // rotate geometry around world x-axis
118
+ _m1.makeRotationX(angle);
119
+
120
+ this.applyMatrix4(_m1);
121
+ return this;
122
+ }
123
+ }, {
124
+ key: "rotateY",
125
+ value: function rotateY(angle) {
126
+ // rotate geometry around world y-axis
127
+ _m1.makeRotationY(angle);
128
+
129
+ this.applyMatrix4(_m1);
130
+ return this;
131
+ }
132
+ }, {
133
+ key: "rotateZ",
134
+ value: function rotateZ(angle) {
135
+ // rotate geometry around world z-axis
136
+ _m1.makeRotationZ(angle);
137
+
138
+ this.applyMatrix4(_m1);
139
+ return this;
140
+ }
141
+ }, {
142
+ key: "translate",
143
+ value: function translate(x, y, z) {
144
+ // translate geometry
145
+ _m1.makeTranslation(x, y, z);
146
+
147
+ this.applyMatrix4(_m1);
148
+ return this;
149
+ }
150
+ }, {
151
+ key: "scale",
152
+ value: function scale(x, y, z) {
153
+ // scale geometry
154
+ _m1.makeScale(x, y, z);
155
+
156
+ this.applyMatrix4(_m1);
157
+ return this;
158
+ }
159
+ }, {
160
+ key: "lookAt",
161
+ value: function lookAt(vector) {
162
+ _obj.lookAt(vector);
163
+
164
+ _obj.updateMatrix();
165
+
166
+ this.applyMatrix4(_obj.matrix);
167
+ return this;
168
+ }
169
+ }, {
170
+ key: "fromBufferGeometry",
171
+ value: function fromBufferGeometry(geometry) {
172
+ var scope = this;
173
+ var index = geometry.index !== null ? geometry.index : undefined;
174
+ var attributes = geometry.attributes;
175
+
176
+ if (attributes.position === undefined) {
177
+ console.error('THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.');
178
+ return this;
179
+ }
180
+
181
+ var position = attributes.position;
182
+ var normal = attributes.normal;
183
+ var color = attributes.color;
184
+ var uv = attributes.uv;
185
+ var uv2 = attributes.uv2;
186
+ if (uv2 !== undefined) this.faceVertexUvs[1] = [];
187
+
188
+ for (var i = 0; i < position.count; i++) {
189
+ scope.vertices.push(new _three.Vector3().fromBufferAttribute(position, i));
190
+
191
+ if (color !== undefined) {
192
+ scope.colors.push(new _three.Color().fromBufferAttribute(color, i));
193
+ }
194
+ }
195
+
196
+ function addFace(a, b, c, materialIndex) {
197
+ var vertexColors = color === undefined ? [] : [scope.colors[a].clone(), scope.colors[b].clone(), scope.colors[c].clone()];
198
+ var vertexNormals = normal === undefined ? [] : [new _three.Vector3().fromBufferAttribute(normal, a), new _three.Vector3().fromBufferAttribute(normal, b), new _three.Vector3().fromBufferAttribute(normal, c)];
199
+ var face = new Face3(a, b, c, vertexNormals, vertexColors, materialIndex);
200
+ scope.faces.push(face);
201
+
202
+ if (uv !== undefined) {
203
+ scope.faceVertexUvs[0].push([new _three.Vector2().fromBufferAttribute(uv, a), new _three.Vector2().fromBufferAttribute(uv, b), new _three.Vector2().fromBufferAttribute(uv, c)]);
204
+ }
205
+
206
+ if (uv2 !== undefined) {
207
+ scope.faceVertexUvs[1].push([new _three.Vector2().fromBufferAttribute(uv2, a), new _three.Vector2().fromBufferAttribute(uv2, b), new _three.Vector2().fromBufferAttribute(uv2, c)]);
208
+ }
209
+ }
210
+
211
+ var groups = geometry.groups;
212
+
213
+ if (groups.length > 0) {
214
+ for (var _i2 = 0; _i2 < groups.length; _i2++) {
215
+ var group = groups[_i2];
216
+ var start = group.start;
217
+ var count = group.count;
218
+
219
+ for (var j = start, jl = start + count; j < jl; j += 3) {
220
+ if (index !== undefined) {
221
+ addFace(index.getX(j), index.getX(j + 1), index.getX(j + 2), group.materialIndex);
222
+ } else {
223
+ addFace(j, j + 1, j + 2, group.materialIndex);
224
+ }
225
+ }
226
+ }
227
+ } else {
228
+ if (index !== undefined) {
229
+ for (var _i3 = 0; _i3 < index.count; _i3 += 3) {
230
+ addFace(index.getX(_i3), index.getX(_i3 + 1), index.getX(_i3 + 2));
231
+ }
232
+ } else {
233
+ for (var _i4 = 0; _i4 < position.count; _i4 += 3) {
234
+ addFace(_i4, _i4 + 1, _i4 + 2);
235
+ }
236
+ }
237
+ }
238
+
239
+ this.computeFaceNormals();
240
+
241
+ if (geometry.boundingBox !== null) {
242
+ this.boundingBox = geometry.boundingBox.clone();
243
+ }
244
+
245
+ if (geometry.boundingSphere !== null) {
246
+ this.boundingSphere = geometry.boundingSphere.clone();
247
+ }
248
+
249
+ return this;
250
+ }
251
+ }, {
252
+ key: "center",
253
+ value: function center() {
254
+ this.computeBoundingBox();
255
+ this.boundingBox.getCenter(_offset).negate();
256
+ this.translate(_offset.x, _offset.y, _offset.z);
257
+ return this;
258
+ }
259
+ }, {
260
+ key: "normalize",
261
+ value: function normalize() {
262
+ this.computeBoundingSphere();
263
+ var center = this.boundingSphere.center;
264
+ var radius = this.boundingSphere.radius;
265
+ var s = radius === 0 ? 1 : 1.0 / radius;
266
+ var matrix = new _three.Matrix4();
267
+ matrix.set(s, 0, 0, -s * center.x, 0, s, 0, -s * center.y, 0, 0, s, -s * center.z, 0, 0, 0, 1);
268
+ this.applyMatrix4(matrix);
269
+ return this;
270
+ }
271
+ }, {
272
+ key: "computeFaceNormals",
273
+ value: function computeFaceNormals() {
274
+ var cb = new _three.Vector3(),
275
+ ab = new _three.Vector3();
276
+
277
+ for (var f = 0, fl = this.faces.length; f < fl; f++) {
278
+ var face = this.faces[f];
279
+ var vA = this.vertices[face.a];
280
+ var vB = this.vertices[face.b];
281
+ var vC = this.vertices[face.c];
282
+ cb.subVectors(vC, vB);
283
+ ab.subVectors(vA, vB);
284
+ cb.cross(ab);
285
+ cb.normalize();
286
+ face.normal.copy(cb);
287
+ }
288
+ }
289
+ }, {
290
+ key: "computeVertexNormals",
291
+ value: function computeVertexNormals() {
292
+ var areaWeighted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
293
+ var vertices = new Array(this.vertices.length);
294
+
295
+ for (var v = 0, vl = this.vertices.length; v < vl; v++) {
296
+ vertices[v] = new _three.Vector3();
297
+ }
298
+
299
+ if (areaWeighted) {
300
+ // vertex normals weighted by triangle areas
301
+ // http://www.iquilezles.org/www/articles/normals/normals.htm
302
+ var cb = new _three.Vector3(),
303
+ ab = new _three.Vector3();
304
+
305
+ for (var f = 0, fl = this.faces.length; f < fl; f++) {
306
+ var face = this.faces[f];
307
+ var vA = this.vertices[face.a];
308
+ var vB = this.vertices[face.b];
309
+ var vC = this.vertices[face.c];
310
+ cb.subVectors(vC, vB);
311
+ ab.subVectors(vA, vB);
312
+ cb.cross(ab);
313
+ vertices[face.a].add(cb);
314
+ vertices[face.b].add(cb);
315
+ vertices[face.c].add(cb);
316
+ }
317
+ } else {
318
+ this.computeFaceNormals();
319
+
320
+ for (var _f = 0, _fl = this.faces.length; _f < _fl; _f++) {
321
+ var _face = this.faces[_f];
322
+
323
+ vertices[_face.a].add(_face.normal);
324
+
325
+ vertices[_face.b].add(_face.normal);
326
+
327
+ vertices[_face.c].add(_face.normal);
328
+ }
329
+ }
330
+
331
+ for (var _v = 0, _vl = this.vertices.length; _v < _vl; _v++) {
332
+ vertices[_v].normalize();
333
+ }
334
+
335
+ for (var _f2 = 0, _fl2 = this.faces.length; _f2 < _fl2; _f2++) {
336
+ var _face2 = this.faces[_f2];
337
+ var vertexNormals = _face2.vertexNormals;
338
+
339
+ if (vertexNormals.length === 3) {
340
+ vertexNormals[0].copy(vertices[_face2.a]);
341
+ vertexNormals[1].copy(vertices[_face2.b]);
342
+ vertexNormals[2].copy(vertices[_face2.c]);
343
+ } else {
344
+ vertexNormals[0] = vertices[_face2.a].clone();
345
+ vertexNormals[1] = vertices[_face2.b].clone();
346
+ vertexNormals[2] = vertices[_face2.c].clone();
347
+ }
348
+ }
349
+
350
+ if (this.faces.length > 0) {
351
+ this.normalsNeedUpdate = true;
352
+ }
353
+ }
354
+ }, {
355
+ key: "computeFlatVertexNormals",
356
+ value: function computeFlatVertexNormals() {
357
+ this.computeFaceNormals();
358
+
359
+ for (var f = 0, fl = this.faces.length; f < fl; f++) {
360
+ var face = this.faces[f];
361
+ var vertexNormals = face.vertexNormals;
362
+
363
+ if (vertexNormals.length === 3) {
364
+ vertexNormals[0].copy(face.normal);
365
+ vertexNormals[1].copy(face.normal);
366
+ vertexNormals[2].copy(face.normal);
367
+ } else {
368
+ vertexNormals[0] = face.normal.clone();
369
+ vertexNormals[1] = face.normal.clone();
370
+ vertexNormals[2] = face.normal.clone();
371
+ }
372
+ }
373
+
374
+ if (this.faces.length > 0) {
375
+ this.normalsNeedUpdate = true;
376
+ }
377
+ }
378
+ }, {
379
+ key: "computeMorphNormals",
380
+ value: function computeMorphNormals() {
381
+ // save original normals
382
+ // - create temp variables on first access
383
+ // otherwise just copy (for faster repeated calls)
384
+ for (var f = 0, fl = this.faces.length; f < fl; f++) {
385
+ var face = this.faces[f];
386
+
387
+ if (!face.__originalFaceNormal) {
388
+ face.__originalFaceNormal = face.normal.clone();
389
+ } else {
390
+ face.__originalFaceNormal.copy(face.normal);
391
+ }
392
+
393
+ if (!face.__originalVertexNormals) face.__originalVertexNormals = [];
394
+
395
+ for (var i = 0, il = face.vertexNormals.length; i < il; i++) {
396
+ if (!face.__originalVertexNormals[i]) {
397
+ face.__originalVertexNormals[i] = face.vertexNormals[i].clone();
398
+ } else {
399
+ face.__originalVertexNormals[i].copy(face.vertexNormals[i]);
400
+ }
401
+ }
402
+ } // use temp geometry to compute face and vertex normals for each morph
403
+
404
+
405
+ var tmpGeo = new Geometry();
406
+ tmpGeo.faces = this.faces;
407
+
408
+ for (var _i5 = 0, _il2 = this.morphTargets.length; _i5 < _il2; _i5++) {
409
+ // create on first access
410
+ if (!this.morphNormals[_i5]) {
411
+ this.morphNormals[_i5] = {};
412
+ this.morphNormals[_i5].faceNormals = [];
413
+ this.morphNormals[_i5].vertexNormals = [];
414
+ var dstNormalsFace = this.morphNormals[_i5].faceNormals;
415
+ var dstNormalsVertex = this.morphNormals[_i5].vertexNormals;
416
+
417
+ for (var _f3 = 0, _fl3 = this.faces.length; _f3 < _fl3; _f3++) {
418
+ var faceNormal = new _three.Vector3();
419
+ var vertexNormals = {
420
+ a: new _three.Vector3(),
421
+ b: new _three.Vector3(),
422
+ c: new _three.Vector3()
423
+ };
424
+ dstNormalsFace.push(faceNormal);
425
+ dstNormalsVertex.push(vertexNormals);
426
+ }
427
+ }
428
+
429
+ var morphNormals = this.morphNormals[_i5]; // set vertices to morph target
430
+
431
+ tmpGeo.vertices = this.morphTargets[_i5].vertices; // compute morph normals
432
+
433
+ tmpGeo.computeFaceNormals();
434
+ tmpGeo.computeVertexNormals(); // store morph normals
435
+
436
+ for (var _f4 = 0, _fl4 = this.faces.length; _f4 < _fl4; _f4++) {
437
+ var _face3 = this.faces[_f4];
438
+ var _faceNormal = morphNormals.faceNormals[_f4];
439
+ var _vertexNormals = morphNormals.vertexNormals[_f4];
440
+
441
+ _faceNormal.copy(_face3.normal);
442
+
443
+ _vertexNormals.a.copy(_face3.vertexNormals[0]);
444
+
445
+ _vertexNormals.b.copy(_face3.vertexNormals[1]);
446
+
447
+ _vertexNormals.c.copy(_face3.vertexNormals[2]);
448
+ }
449
+ } // restore original normals
450
+
451
+
452
+ for (var _f5 = 0, _fl5 = this.faces.length; _f5 < _fl5; _f5++) {
453
+ var _face4 = this.faces[_f5];
454
+ _face4.normal = _face4.__originalFaceNormal;
455
+ _face4.vertexNormals = _face4.__originalVertexNormals;
456
+ }
457
+ }
458
+ }, {
459
+ key: "computeBoundingBox",
460
+ value: function computeBoundingBox() {
461
+ if (this.boundingBox === null) {
462
+ this.boundingBox = new _three.Box3();
463
+ }
464
+
465
+ this.boundingBox.setFromPoints(this.vertices);
466
+ }
467
+ }, {
468
+ key: "computeBoundingSphere",
469
+ value: function computeBoundingSphere() {
470
+ if (this.boundingSphere === null) {
471
+ this.boundingSphere = new _three.Sphere();
472
+ }
473
+
474
+ this.boundingSphere.setFromPoints(this.vertices);
475
+ }
476
+ }, {
477
+ key: "merge",
478
+ value: function merge(geometry, matrix) {
479
+ var materialIndexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
480
+
481
+ if (!(geometry && geometry.isGeometry)) {
482
+ console.error('THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry);
483
+ return;
484
+ }
485
+
486
+ var normalMatrix;
487
+ var vertexOffset = this.vertices.length,
488
+ vertices1 = this.vertices,
489
+ vertices2 = geometry.vertices,
490
+ faces1 = this.faces,
491
+ faces2 = geometry.faces,
492
+ colors1 = this.colors,
493
+ colors2 = geometry.colors;
494
+
495
+ if (matrix !== undefined) {
496
+ normalMatrix = new _three.Matrix3().getNormalMatrix(matrix);
497
+ } // vertices
498
+
499
+
500
+ for (var i = 0, il = vertices2.length; i < il; i++) {
501
+ var vertex = vertices2[i];
502
+ var vertexCopy = vertex.clone();
503
+ if (matrix !== undefined) vertexCopy.applyMatrix4(matrix);
504
+ vertices1.push(vertexCopy);
505
+ } // colors
506
+
507
+
508
+ for (var _i6 = 0, _il3 = colors2.length; _i6 < _il3; _i6++) {
509
+ colors1.push(colors2[_i6].clone());
510
+ } // faces
511
+
512
+
513
+ for (var _i7 = 0, _il4 = faces2.length; _i7 < _il4; _i7++) {
514
+ var face = faces2[_i7];
515
+ var normal = void 0,
516
+ color = void 0;
517
+ var faceVertexNormals = face.vertexNormals,
518
+ faceVertexColors = face.vertexColors;
519
+ var faceCopy = new Face3(face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset);
520
+ faceCopy.normal.copy(face.normal);
521
+
522
+ if (normalMatrix !== undefined) {
523
+ faceCopy.normal.applyMatrix3(normalMatrix).normalize();
524
+ }
525
+
526
+ for (var j = 0, jl = faceVertexNormals.length; j < jl; j++) {
527
+ normal = faceVertexNormals[j].clone();
528
+
529
+ if (normalMatrix !== undefined) {
530
+ normal.applyMatrix3(normalMatrix).normalize();
531
+ }
532
+
533
+ faceCopy.vertexNormals.push(normal);
534
+ }
535
+
536
+ faceCopy.color.copy(face.color);
537
+
538
+ for (var _j = 0, _jl = faceVertexColors.length; _j < _jl; _j++) {
539
+ color = faceVertexColors[_j];
540
+ faceCopy.vertexColors.push(color.clone());
541
+ }
542
+
543
+ faceCopy.materialIndex = face.materialIndex + materialIndexOffset;
544
+ faces1.push(faceCopy);
545
+ } // uvs
546
+
547
+
548
+ for (var _i8 = 0, _il5 = geometry.faceVertexUvs.length; _i8 < _il5; _i8++) {
549
+ var faceVertexUvs2 = geometry.faceVertexUvs[_i8];
550
+ if (this.faceVertexUvs[_i8] === undefined) this.faceVertexUvs[_i8] = [];
551
+
552
+ for (var _j2 = 0, _jl2 = faceVertexUvs2.length; _j2 < _jl2; _j2++) {
553
+ var uvs2 = faceVertexUvs2[_j2],
554
+ uvsCopy = [];
555
+
556
+ for (var k = 0, kl = uvs2.length; k < kl; k++) {
557
+ uvsCopy.push(uvs2[k].clone());
558
+ }
559
+
560
+ this.faceVertexUvs[_i8].push(uvsCopy);
561
+ }
562
+ }
563
+ }
564
+ }, {
565
+ key: "mergeMesh",
566
+ value: function mergeMesh(mesh) {
567
+ if (!(mesh && mesh.isMesh)) {
568
+ console.error('THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh);
569
+ return;
570
+ }
571
+
572
+ if (mesh.matrixAutoUpdate) mesh.updateMatrix();
573
+ this.merge(mesh.geometry, mesh.matrix);
574
+ }
575
+ /*
576
+ * Checks for duplicate vertices with hashmap.
577
+ * Duplicated vertices are removed
578
+ * and faces' vertices are updated.
579
+ */
580
+
581
+ }, {
582
+ key: "mergeVertices",
583
+ value: function mergeVertices() {
584
+ var precisionPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4;
585
+ var verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)
586
+
587
+ var unique = [],
588
+ changes = [];
589
+ var precision = Math.pow(10, precisionPoints);
590
+
591
+ for (var i = 0, il = this.vertices.length; i < il; i++) {
592
+ var v = this.vertices[i];
593
+ var key = Math.round(v.x * precision) + '_' + Math.round(v.y * precision) + '_' + Math.round(v.z * precision);
594
+
595
+ if (verticesMap[key] === undefined) {
596
+ verticesMap[key] = i;
597
+ unique.push(this.vertices[i]);
598
+ changes[i] = unique.length - 1;
599
+ } else {
600
+ //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);
601
+ changes[i] = changes[verticesMap[key]];
602
+ }
603
+ } // if faces are completely degenerate after merging vertices, we
604
+ // have to remove them from the geometry.
605
+
606
+
607
+ var faceIndicesToRemove = [];
608
+
609
+ for (var _i9 = 0, _il6 = this.faces.length; _i9 < _il6; _i9++) {
610
+ var face = this.faces[_i9];
611
+ face.a = changes[face.a];
612
+ face.b = changes[face.b];
613
+ face.c = changes[face.c];
614
+ var indices = [face.a, face.b, face.c]; // if any duplicate vertices are found in a Face3
615
+ // we have to remove the face as nothing can be saved
616
+
617
+ for (var n = 0; n < 3; n++) {
618
+ if (indices[n] === indices[(n + 1) % 3]) {
619
+ faceIndicesToRemove.push(_i9);
620
+ break;
621
+ }
622
+ }
623
+ }
624
+
625
+ for (var _i10 = faceIndicesToRemove.length - 1; _i10 >= 0; _i10--) {
626
+ var idx = faceIndicesToRemove[_i10];
627
+ this.faces.splice(idx, 1);
628
+
629
+ for (var j = 0, jl = this.faceVertexUvs.length; j < jl; j++) {
630
+ this.faceVertexUvs[j].splice(idx, 1);
631
+ }
632
+ } // Use unique set of vertices
633
+
634
+
635
+ var diff = this.vertices.length - unique.length;
636
+ this.vertices = unique;
637
+ return diff;
638
+ }
639
+ }, {
640
+ key: "setFromPoints",
641
+ value: function setFromPoints(points) {
642
+ this.vertices = [];
643
+
644
+ for (var i = 0, l = points.length; i < l; i++) {
645
+ var point = points[i];
646
+ this.vertices.push(new _three.Vector3(point.x, point.y, point.z || 0));
647
+ }
648
+
649
+ return this;
650
+ }
651
+ }, {
652
+ key: "sortFacesByMaterialIndex",
653
+ value: function sortFacesByMaterialIndex() {
654
+ var faces = this.faces;
655
+ var length = faces.length; // tag faces
656
+
657
+ for (var i = 0; i < length; i++) {
658
+ faces[i]._id = i;
659
+ } // sort faces
660
+
661
+
662
+ function materialIndexSort(a, b) {
663
+ return a.materialIndex - b.materialIndex;
664
+ }
665
+
666
+ faces.sort(materialIndexSort); // sort uvs
667
+
668
+ var uvs1 = this.faceVertexUvs[0];
669
+ var uvs2 = this.faceVertexUvs[1];
670
+ var newUvs1, newUvs2;
671
+ if (uvs1 && uvs1.length === length) newUvs1 = [];
672
+ if (uvs2 && uvs2.length === length) newUvs2 = [];
673
+
674
+ for (var _i11 = 0; _i11 < length; _i11++) {
675
+ var id = faces[_i11]._id;
676
+ if (newUvs1) newUvs1.push(uvs1[id]);
677
+ if (newUvs2) newUvs2.push(uvs2[id]);
678
+ }
679
+
680
+ if (newUvs1) this.faceVertexUvs[0] = newUvs1;
681
+ if (newUvs2) this.faceVertexUvs[1] = newUvs2;
682
+ }
683
+ }, {
684
+ key: "toJSON",
685
+ value: function toJSON() {
686
+ var data = {
687
+ metadata: {
688
+ version: 4.5,
689
+ type: 'Geometry',
690
+ generator: 'Geometry.toJSON'
691
+ }
692
+ }; // standard Geometry serialization
693
+
694
+ data.uuid = this.uuid;
695
+ data.type = this.type;
696
+ if (this.name !== '') data.name = this.name;
697
+
698
+ if (this.parameters !== undefined) {
699
+ var parameters = this.parameters;
700
+
701
+ for (var key in parameters) {
702
+ if (parameters[key] !== undefined) data[key] = parameters[key];
703
+ }
704
+
705
+ return data;
706
+ }
707
+
708
+ var vertices = [];
709
+
710
+ for (var i = 0; i < this.vertices.length; i++) {
711
+ var vertex = this.vertices[i];
712
+ vertices.push(vertex.x, vertex.y, vertex.z);
713
+ }
714
+
715
+ var faces = [];
716
+ var normals = [];
717
+ var normalsHash = {};
718
+ var colors = [];
719
+ var colorsHash = {};
720
+ var uvs = [];
721
+ var uvsHash = {};
722
+
723
+ for (var _i12 = 0; _i12 < this.faces.length; _i12++) {
724
+ var face = this.faces[_i12];
725
+ var hasMaterial = true;
726
+ var hasFaceUv = false; // deprecated
727
+
728
+ var hasFaceVertexUv = this.faceVertexUvs[0][_i12] !== undefined;
729
+ var hasFaceNormal = face.normal.length() > 0;
730
+ var hasFaceVertexNormal = face.vertexNormals.length > 0;
731
+ var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;
732
+ var hasFaceVertexColor = face.vertexColors.length > 0;
733
+ var faceType = 0;
734
+ faceType = setBit(faceType, 0, 0); // isQuad
735
+
736
+ faceType = setBit(faceType, 1, hasMaterial);
737
+ faceType = setBit(faceType, 2, hasFaceUv);
738
+ faceType = setBit(faceType, 3, hasFaceVertexUv);
739
+ faceType = setBit(faceType, 4, hasFaceNormal);
740
+ faceType = setBit(faceType, 5, hasFaceVertexNormal);
741
+ faceType = setBit(faceType, 6, hasFaceColor);
742
+ faceType = setBit(faceType, 7, hasFaceVertexColor);
743
+ faces.push(faceType);
744
+ faces.push(face.a, face.b, face.c);
745
+ faces.push(face.materialIndex);
746
+
747
+ if (hasFaceVertexUv) {
748
+ var faceVertexUvs = this.faceVertexUvs[0][_i12];
749
+ faces.push(getUvIndex(faceVertexUvs[0]), getUvIndex(faceVertexUvs[1]), getUvIndex(faceVertexUvs[2]));
750
+ }
751
+
752
+ if (hasFaceNormal) {
753
+ faces.push(getNormalIndex(face.normal));
754
+ }
755
+
756
+ if (hasFaceVertexNormal) {
757
+ var vertexNormals = face.vertexNormals;
758
+ faces.push(getNormalIndex(vertexNormals[0]), getNormalIndex(vertexNormals[1]), getNormalIndex(vertexNormals[2]));
759
+ }
760
+
761
+ if (hasFaceColor) {
762
+ faces.push(getColorIndex(face.color));
763
+ }
764
+
765
+ if (hasFaceVertexColor) {
766
+ var vertexColors = face.vertexColors;
767
+ faces.push(getColorIndex(vertexColors[0]), getColorIndex(vertexColors[1]), getColorIndex(vertexColors[2]));
768
+ }
769
+ }
770
+
771
+ function setBit(value, position, enabled) {
772
+ return enabled ? value | 1 << position : value & ~(1 << position);
773
+ }
774
+
775
+ function getNormalIndex(normal) {
776
+ var hash = normal.x.toString() + normal.y.toString() + normal.z.toString();
777
+
778
+ if (normalsHash[hash] !== undefined) {
779
+ return normalsHash[hash];
780
+ }
781
+
782
+ normalsHash[hash] = normals.length / 3;
783
+ normals.push(normal.x, normal.y, normal.z);
784
+ return normalsHash[hash];
785
+ }
786
+
787
+ function getColorIndex(color) {
788
+ var hash = color.r.toString() + color.g.toString() + color.b.toString();
789
+
790
+ if (colorsHash[hash] !== undefined) {
791
+ return colorsHash[hash];
792
+ }
793
+
794
+ colorsHash[hash] = colors.length;
795
+ colors.push(color.getHex());
796
+ return colorsHash[hash];
797
+ }
798
+
799
+ function getUvIndex(uv) {
800
+ var hash = uv.x.toString() + uv.y.toString();
801
+
802
+ if (uvsHash[hash] !== undefined) {
803
+ return uvsHash[hash];
804
+ }
805
+
806
+ uvsHash[hash] = uvs.length / 2;
807
+ uvs.push(uv.x, uv.y);
808
+ return uvsHash[hash];
809
+ }
810
+
811
+ data.data = {};
812
+ data.data.vertices = vertices;
813
+ data.data.normals = normals;
814
+ if (colors.length > 0) data.data.colors = colors;
815
+ if (uvs.length > 0) data.data.uvs = [uvs]; // temporal backward compatibility
816
+
817
+ data.data.faces = faces;
818
+ return data;
819
+ }
820
+ }, {
821
+ key: "clone",
822
+ value: function clone() {
823
+ /*
824
+ // Handle primitives
825
+ const parameters = this.parameters;
826
+ if ( parameters !== undefined ) {
827
+ const values = [];
828
+ for ( const key in parameters ) {
829
+ values.push( parameters[ key ] );
830
+ }
831
+ const geometry = Object.create( this.constructor.prototype );
832
+ this.constructor.apply( geometry, values );
833
+ return geometry;
834
+ }
835
+ return new this.constructor().copy( this );
836
+ */
837
+ return new Geometry().copy(this);
838
+ }
839
+ }, {
840
+ key: "copy",
841
+ value: function copy(source) {
842
+ // reset
843
+ this.vertices = [];
844
+ this.colors = [];
845
+ this.faces = [];
846
+ this.faceVertexUvs = [[]];
847
+ this.morphTargets = [];
848
+ this.morphNormals = [];
849
+ this.skinWeights = [];
850
+ this.skinIndices = [];
851
+ this.lineDistances = [];
852
+ this.boundingBox = null;
853
+ this.boundingSphere = null; // name
854
+
855
+ this.name = source.name; // vertices
856
+
857
+ var vertices = source.vertices;
858
+
859
+ for (var i = 0, il = vertices.length; i < il; i++) {
860
+ this.vertices.push(vertices[i].clone());
861
+ } // colors
862
+
863
+
864
+ var colors = source.colors;
865
+
866
+ for (var _i13 = 0, _il7 = colors.length; _i13 < _il7; _i13++) {
867
+ this.colors.push(colors[_i13].clone());
868
+ } // faces
869
+
870
+
871
+ var faces = source.faces;
872
+
873
+ for (var _i14 = 0, _il8 = faces.length; _i14 < _il8; _i14++) {
874
+ this.faces.push(faces[_i14].clone());
875
+ } // face vertex uvs
876
+
877
+
878
+ for (var _i15 = 0, _il9 = source.faceVertexUvs.length; _i15 < _il9; _i15++) {
879
+ var faceVertexUvs = source.faceVertexUvs[_i15];
880
+
881
+ if (this.faceVertexUvs[_i15] === undefined) {
882
+ this.faceVertexUvs[_i15] = [];
883
+ }
884
+
885
+ for (var j = 0, jl = faceVertexUvs.length; j < jl; j++) {
886
+ var uvs = faceVertexUvs[j],
887
+ uvsCopy = [];
888
+
889
+ for (var k = 0, kl = uvs.length; k < kl; k++) {
890
+ var uv = uvs[k];
891
+ uvsCopy.push(uv.clone());
892
+ }
893
+
894
+ this.faceVertexUvs[_i15].push(uvsCopy);
895
+ }
896
+ } // morph targets
897
+
898
+
899
+ var morphTargets = source.morphTargets;
900
+
901
+ for (var _i16 = 0, _il10 = morphTargets.length; _i16 < _il10; _i16++) {
902
+ var morphTarget = {};
903
+ morphTarget.name = morphTargets[_i16].name; // vertices
904
+
905
+ if (morphTargets[_i16].vertices !== undefined) {
906
+ morphTarget.vertices = [];
907
+
908
+ for (var _j3 = 0, _jl3 = morphTargets[_i16].vertices.length; _j3 < _jl3; _j3++) {
909
+ morphTarget.vertices.push(morphTargets[_i16].vertices[_j3].clone());
910
+ }
911
+ } // normals
912
+
913
+
914
+ if (morphTargets[_i16].normals !== undefined) {
915
+ morphTarget.normals = [];
916
+
917
+ for (var _j4 = 0, _jl4 = morphTargets[_i16].normals.length; _j4 < _jl4; _j4++) {
918
+ morphTarget.normals.push(morphTargets[_i16].normals[_j4].clone());
919
+ }
920
+ }
921
+
922
+ this.morphTargets.push(morphTarget);
923
+ } // morph normals
924
+
925
+
926
+ var morphNormals = source.morphNormals;
927
+
928
+ for (var _i17 = 0, _il11 = morphNormals.length; _i17 < _il11; _i17++) {
929
+ var morphNormal = {}; // vertex normals
930
+
931
+ if (morphNormals[_i17].vertexNormals !== undefined) {
932
+ morphNormal.vertexNormals = [];
933
+
934
+ for (var _j5 = 0, _jl5 = morphNormals[_i17].vertexNormals.length; _j5 < _jl5; _j5++) {
935
+ var srcVertexNormal = morphNormals[_i17].vertexNormals[_j5];
936
+ var destVertexNormal = {};
937
+ destVertexNormal.a = srcVertexNormal.a.clone();
938
+ destVertexNormal.b = srcVertexNormal.b.clone();
939
+ destVertexNormal.c = srcVertexNormal.c.clone();
940
+ morphNormal.vertexNormals.push(destVertexNormal);
941
+ }
942
+ } // face normals
943
+
944
+
945
+ if (morphNormals[_i17].faceNormals !== undefined) {
946
+ morphNormal.faceNormals = [];
947
+
948
+ for (var _j6 = 0, _jl6 = morphNormals[_i17].faceNormals.length; _j6 < _jl6; _j6++) {
949
+ morphNormal.faceNormals.push(morphNormals[_i17].faceNormals[_j6].clone());
950
+ }
951
+ }
952
+
953
+ this.morphNormals.push(morphNormal);
954
+ } // skin weights
955
+
956
+
957
+ var skinWeights = source.skinWeights;
958
+
959
+ for (var _i18 = 0, _il12 = skinWeights.length; _i18 < _il12; _i18++) {
960
+ this.skinWeights.push(skinWeights[_i18].clone());
961
+ } // skin indices
962
+
963
+
964
+ var skinIndices = source.skinIndices;
965
+
966
+ for (var _i19 = 0, _il13 = skinIndices.length; _i19 < _il13; _i19++) {
967
+ this.skinIndices.push(skinIndices[_i19].clone());
968
+ } // line distances
969
+
970
+
971
+ var lineDistances = source.lineDistances;
972
+
973
+ for (var _i20 = 0, _il14 = lineDistances.length; _i20 < _il14; _i20++) {
974
+ this.lineDistances.push(lineDistances[_i20]);
975
+ } // bounding box
976
+
977
+
978
+ var boundingBox = source.boundingBox;
979
+
980
+ if (boundingBox !== null) {
981
+ this.boundingBox = boundingBox.clone();
982
+ } // bounding sphere
983
+
984
+
985
+ var boundingSphere = source.boundingSphere;
986
+
987
+ if (boundingSphere !== null) {
988
+ this.boundingSphere = boundingSphere.clone();
989
+ } // update flags
990
+
991
+
992
+ this.elementsNeedUpdate = source.elementsNeedUpdate;
993
+ this.verticesNeedUpdate = source.verticesNeedUpdate;
994
+ this.uvsNeedUpdate = source.uvsNeedUpdate;
995
+ this.normalsNeedUpdate = source.normalsNeedUpdate;
996
+ this.colorsNeedUpdate = source.colorsNeedUpdate;
997
+ this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;
998
+ this.groupsNeedUpdate = source.groupsNeedUpdate;
999
+ return this;
1000
+ }
1001
+ }, {
1002
+ key: "toBufferGeometry",
1003
+ value: function toBufferGeometry() {
1004
+ var geometry = new DirectGeometry().fromGeometry(this);
1005
+ var buffergeometry = new _three.BufferGeometry();
1006
+ var positions = new Float32Array(geometry.vertices.length * 3);
1007
+ buffergeometry.setAttribute('position', new _three.BufferAttribute(positions, 3).copyVector3sArray(geometry.vertices));
1008
+
1009
+ if (geometry.normals.length > 0) {
1010
+ var normals = new Float32Array(geometry.normals.length * 3);
1011
+ buffergeometry.setAttribute('normal', new _three.BufferAttribute(normals, 3).copyVector3sArray(geometry.normals));
1012
+ }
1013
+
1014
+ if (geometry.colors.length > 0) {
1015
+ var colors = new Float32Array(geometry.colors.length * 3);
1016
+ buffergeometry.setAttribute('color', new _three.BufferAttribute(colors, 3).copyColorsArray(geometry.colors));
1017
+ }
1018
+
1019
+ if (geometry.uvs.length > 0) {
1020
+ var uvs = new Float32Array(geometry.uvs.length * 2);
1021
+ buffergeometry.setAttribute('uv', new _three.BufferAttribute(uvs, 2).copyVector2sArray(geometry.uvs));
1022
+ }
1023
+
1024
+ if (geometry.uvs2.length > 0) {
1025
+ var uvs2 = new Float32Array(geometry.uvs2.length * 2);
1026
+ buffergeometry.setAttribute('uv2', new _three.BufferAttribute(uvs2, 2).copyVector2sArray(geometry.uvs2));
1027
+ } // groups
1028
+
1029
+
1030
+ buffergeometry.groups = geometry.groups; // morphs
1031
+
1032
+ for (var name in geometry.morphTargets) {
1033
+ var array = [];
1034
+ var morphTargets = geometry.morphTargets[name];
1035
+
1036
+ for (var i = 0, l = morphTargets.length; i < l; i++) {
1037
+ var morphTarget = morphTargets[i];
1038
+ var attribute = new _three.Float32BufferAttribute(morphTarget.data.length * 3, 3);
1039
+ attribute.name = morphTarget.name;
1040
+ array.push(attribute.copyVector3sArray(morphTarget.data));
1041
+ }
1042
+
1043
+ buffergeometry.morphAttributes[name] = array;
1044
+ } // skinning
1045
+
1046
+
1047
+ if (geometry.skinIndices.length > 0) {
1048
+ var skinIndices = new _three.Float32BufferAttribute(geometry.skinIndices.length * 4, 4);
1049
+ buffergeometry.setAttribute('skinIndex', skinIndices.copyVector4sArray(geometry.skinIndices));
1050
+ }
1051
+
1052
+ if (geometry.skinWeights.length > 0) {
1053
+ var skinWeights = new _three.Float32BufferAttribute(geometry.skinWeights.length * 4, 4);
1054
+ buffergeometry.setAttribute('skinWeight', skinWeights.copyVector4sArray(geometry.skinWeights));
1055
+ } //
1056
+
1057
+
1058
+ if (geometry.boundingSphere !== null) {
1059
+ buffergeometry.boundingSphere = geometry.boundingSphere.clone();
1060
+ }
1061
+
1062
+ if (geometry.boundingBox !== null) {
1063
+ buffergeometry.boundingBox = geometry.boundingBox.clone();
1064
+ }
1065
+
1066
+ return buffergeometry;
1067
+ }
1068
+ }, {
1069
+ key: "computeTangents",
1070
+ value: function computeTangents() {
1071
+ console.error('THREE.Geometry: .computeTangents() has been removed.');
1072
+ }
1073
+ }, {
1074
+ key: "computeLineDistances",
1075
+ value: function computeLineDistances() {
1076
+ console.error('THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.');
1077
+ }
1078
+ }, {
1079
+ key: "applyMatrix",
1080
+ value: function applyMatrix(matrix) {
1081
+ console.warn('THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().');
1082
+ return this.applyMatrix4(matrix);
1083
+ }
1084
+ }, {
1085
+ key: "dispose",
1086
+ value: function dispose() {
1087
+ this.dispatchEvent({
1088
+ type: 'dispose'
1089
+ });
1090
+ }
1091
+ }], [{
1092
+ key: "createBufferGeometryFromObject",
1093
+ value: function createBufferGeometryFromObject(object) {
1094
+ var buffergeometry = new _three.BufferGeometry();
1095
+ var geometry = object.geometry;
1096
+
1097
+ if (object.isPoints || object.isLine) {
1098
+ var positions = new _three.Float32BufferAttribute(geometry.vertices.length * 3, 3);
1099
+ var colors = new _three.Float32BufferAttribute(geometry.colors.length * 3, 3);
1100
+ buffergeometry.setAttribute('position', positions.copyVector3sArray(geometry.vertices));
1101
+ buffergeometry.setAttribute('color', colors.copyColorsArray(geometry.colors));
1102
+
1103
+ if (geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length) {
1104
+ var lineDistances = new _three.Float32BufferAttribute(geometry.lineDistances.length, 1);
1105
+ buffergeometry.setAttribute('lineDistance', lineDistances.copyArray(geometry.lineDistances));
1106
+ }
1107
+
1108
+ if (geometry.boundingSphere !== null) {
1109
+ buffergeometry.boundingSphere = geometry.boundingSphere.clone();
1110
+ }
1111
+
1112
+ if (geometry.boundingBox !== null) {
1113
+ buffergeometry.boundingBox = geometry.boundingBox.clone();
1114
+ }
1115
+ } else if (object.isMesh) {
1116
+ buffergeometry = geometry.toBufferGeometry();
1117
+ }
1118
+
1119
+ return buffergeometry;
1120
+ }
1121
+ }]);
1122
+
1123
+ return Geometry;
1124
+ }(_three.EventDispatcher);
1125
+
1126
+ _exports.Geometry = Geometry;
1127
+ Geometry.prototype.isGeometry = true;
1128
+
1129
+ var DirectGeometry = /*#__PURE__*/function () {
1130
+ function DirectGeometry() {
1131
+ _classCallCheck(this, DirectGeometry);
1132
+
1133
+ this.vertices = [];
1134
+ this.normals = [];
1135
+ this.colors = [];
1136
+ this.uvs = [];
1137
+ this.uvs2 = [];
1138
+ this.groups = [];
1139
+ this.morphTargets = {};
1140
+ this.skinWeights = [];
1141
+ this.skinIndices = []; // this.lineDistances = [];
1142
+
1143
+ this.boundingBox = null;
1144
+ this.boundingSphere = null; // update flags
1145
+
1146
+ this.verticesNeedUpdate = false;
1147
+ this.normalsNeedUpdate = false;
1148
+ this.colorsNeedUpdate = false;
1149
+ this.uvsNeedUpdate = false;
1150
+ this.groupsNeedUpdate = false;
1151
+ }
1152
+
1153
+ _createClass(DirectGeometry, [{
1154
+ key: "computeGroups",
1155
+ value: function computeGroups(geometry) {
1156
+ var groups = [];
1157
+ var group, i;
1158
+ var materialIndex = undefined;
1159
+ var faces = geometry.faces;
1160
+
1161
+ for (i = 0; i < faces.length; i++) {
1162
+ var face = faces[i]; // materials
1163
+
1164
+ if (face.materialIndex !== materialIndex) {
1165
+ materialIndex = face.materialIndex;
1166
+
1167
+ if (group !== undefined) {
1168
+ group.count = i * 3 - group.start;
1169
+ groups.push(group);
1170
+ }
1171
+
1172
+ group = {
1173
+ start: i * 3,
1174
+ materialIndex: materialIndex
1175
+ };
1176
+ }
1177
+ }
1178
+
1179
+ if (group !== undefined) {
1180
+ group.count = i * 3 - group.start;
1181
+ groups.push(group);
1182
+ }
1183
+
1184
+ this.groups = groups;
1185
+ }
1186
+ }, {
1187
+ key: "fromGeometry",
1188
+ value: function fromGeometry(geometry) {
1189
+ var faces = geometry.faces;
1190
+ var vertices = geometry.vertices;
1191
+ var faceVertexUvs = geometry.faceVertexUvs;
1192
+ var hasFaceVertexUv = faceVertexUvs[0] && faceVertexUvs[0].length > 0;
1193
+ var hasFaceVertexUv2 = faceVertexUvs[1] && faceVertexUvs[1].length > 0; // morphs
1194
+
1195
+ var morphTargets = geometry.morphTargets;
1196
+ var morphTargetsLength = morphTargets.length;
1197
+ var morphTargetsPosition;
1198
+
1199
+ if (morphTargetsLength > 0) {
1200
+ morphTargetsPosition = [];
1201
+
1202
+ for (var i = 0; i < morphTargetsLength; i++) {
1203
+ morphTargetsPosition[i] = {
1204
+ name: morphTargets[i].name,
1205
+ data: []
1206
+ };
1207
+ }
1208
+
1209
+ this.morphTargets.position = morphTargetsPosition;
1210
+ }
1211
+
1212
+ var morphNormals = geometry.morphNormals;
1213
+ var morphNormalsLength = morphNormals.length;
1214
+ var morphTargetsNormal;
1215
+
1216
+ if (morphNormalsLength > 0) {
1217
+ morphTargetsNormal = [];
1218
+
1219
+ for (var _i21 = 0; _i21 < morphNormalsLength; _i21++) {
1220
+ morphTargetsNormal[_i21] = {
1221
+ name: morphNormals[_i21].name,
1222
+ data: []
1223
+ };
1224
+ }
1225
+
1226
+ this.morphTargets.normal = morphTargetsNormal;
1227
+ } // skins
1228
+
1229
+
1230
+ var skinIndices = geometry.skinIndices;
1231
+ var skinWeights = geometry.skinWeights;
1232
+ var hasSkinIndices = skinIndices.length === vertices.length;
1233
+ var hasSkinWeights = skinWeights.length === vertices.length; //
1234
+
1235
+ if (vertices.length > 0 && faces.length === 0) {
1236
+ console.error('THREE.DirectGeometry: Faceless geometries are not supported.');
1237
+ }
1238
+
1239
+ for (var _i22 = 0; _i22 < faces.length; _i22++) {
1240
+ var face = faces[_i22];
1241
+ this.vertices.push(vertices[face.a], vertices[face.b], vertices[face.c]);
1242
+ var vertexNormals = face.vertexNormals;
1243
+
1244
+ if (vertexNormals.length === 3) {
1245
+ this.normals.push(vertexNormals[0], vertexNormals[1], vertexNormals[2]);
1246
+ } else {
1247
+ var normal = face.normal;
1248
+ this.normals.push(normal, normal, normal);
1249
+ }
1250
+
1251
+ var vertexColors = face.vertexColors;
1252
+
1253
+ if (vertexColors.length === 3) {
1254
+ this.colors.push(vertexColors[0], vertexColors[1], vertexColors[2]);
1255
+ } else {
1256
+ var color = face.color;
1257
+ this.colors.push(color, color, color);
1258
+ }
1259
+
1260
+ if (hasFaceVertexUv === true) {
1261
+ var vertexUvs = faceVertexUvs[0][_i22];
1262
+
1263
+ if (vertexUvs !== undefined) {
1264
+ this.uvs.push(vertexUvs[0], vertexUvs[1], vertexUvs[2]);
1265
+ } else {
1266
+ console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', _i22);
1267
+ this.uvs.push(new _three.Vector2(), new _three.Vector2(), new _three.Vector2());
1268
+ }
1269
+ }
1270
+
1271
+ if (hasFaceVertexUv2 === true) {
1272
+ var _vertexUvs = faceVertexUvs[1][_i22];
1273
+
1274
+ if (_vertexUvs !== undefined) {
1275
+ this.uvs2.push(_vertexUvs[0], _vertexUvs[1], _vertexUvs[2]);
1276
+ } else {
1277
+ console.warn('THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', _i22);
1278
+ this.uvs2.push(new _three.Vector2(), new _three.Vector2(), new _three.Vector2());
1279
+ }
1280
+ } // morphs
1281
+
1282
+
1283
+ for (var j = 0; j < morphTargetsLength; j++) {
1284
+ var morphTarget = morphTargets[j].vertices;
1285
+ morphTargetsPosition[j].data.push(morphTarget[face.a], morphTarget[face.b], morphTarget[face.c]);
1286
+ }
1287
+
1288
+ for (var _j7 = 0; _j7 < morphNormalsLength; _j7++) {
1289
+ var morphNormal = morphNormals[_j7].vertexNormals[_i22];
1290
+
1291
+ morphTargetsNormal[_j7].data.push(morphNormal.a, morphNormal.b, morphNormal.c);
1292
+ } // skins
1293
+
1294
+
1295
+ if (hasSkinIndices) {
1296
+ this.skinIndices.push(skinIndices[face.a], skinIndices[face.b], skinIndices[face.c]);
1297
+ }
1298
+
1299
+ if (hasSkinWeights) {
1300
+ this.skinWeights.push(skinWeights[face.a], skinWeights[face.b], skinWeights[face.c]);
1301
+ }
1302
+ }
1303
+
1304
+ this.computeGroups(geometry);
1305
+ this.verticesNeedUpdate = geometry.verticesNeedUpdate;
1306
+ this.normalsNeedUpdate = geometry.normalsNeedUpdate;
1307
+ this.colorsNeedUpdate = geometry.colorsNeedUpdate;
1308
+ this.uvsNeedUpdate = geometry.uvsNeedUpdate;
1309
+ this.groupsNeedUpdate = geometry.groupsNeedUpdate;
1310
+
1311
+ if (geometry.boundingSphere !== null) {
1312
+ this.boundingSphere = geometry.boundingSphere.clone();
1313
+ }
1314
+
1315
+ if (geometry.boundingBox !== null) {
1316
+ this.boundingBox = geometry.boundingBox.clone();
1317
+ }
1318
+
1319
+ return this;
1320
+ }
1321
+ }]);
1322
+
1323
+ return DirectGeometry;
1324
+ }();
1325
+
1326
+ var Face3 = /*#__PURE__*/function () {
1327
+ function Face3(a, b, c, normal, color) {
1328
+ var materialIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1329
+
1330
+ _classCallCheck(this, Face3);
1331
+
1332
+ this.a = a;
1333
+ this.b = b;
1334
+ this.c = c;
1335
+ this.normal = normal && normal.isVector3 ? normal : new _three.Vector3();
1336
+ this.vertexNormals = Array.isArray(normal) ? normal : [];
1337
+ this.color = color && color.isColor ? color : new _three.Color();
1338
+ this.vertexColors = Array.isArray(color) ? color : [];
1339
+ this.materialIndex = materialIndex;
1340
+ }
1341
+
1342
+ _createClass(Face3, [{
1343
+ key: "clone",
1344
+ value: function clone() {
1345
+ return new this.constructor().copy(this);
1346
+ }
1347
+ }, {
1348
+ key: "copy",
1349
+ value: function copy(source) {
1350
+ this.a = source.a;
1351
+ this.b = source.b;
1352
+ this.c = source.c;
1353
+ this.normal.copy(source.normal);
1354
+ this.color.copy(source.color);
1355
+ this.materialIndex = source.materialIndex;
1356
+
1357
+ for (var i = 0, il = source.vertexNormals.length; i < il; i++) {
1358
+ this.vertexNormals[i] = source.vertexNormals[i].clone();
1359
+ }
1360
+
1361
+ for (var _i23 = 0, _il15 = source.vertexColors.length; _i23 < _il15; _i23++) {
1362
+ this.vertexColors[_i23] = source.vertexColors[_i23].clone();
1363
+ }
1364
+
1365
+ return this;
1366
+ }
1367
+ }]);
1368
+
1369
+ return Face3;
1370
+ }();
1371
+
1372
+ _exports.Face3 = Face3;
1373
+ });