@needle-tools/three 0.154.3 → 0.160.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (957) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +86 -84
  3. package/build/three.cjs +53679 -51654
  4. package/build/three.module.js +53263 -51253
  5. package/build/three.module.min.js +6 -6
  6. package/examples/fonts/LICENSE +13 -13
  7. package/examples/fonts/README.md +11 -11
  8. package/examples/fonts/droid/NOTICE +190 -190
  9. package/examples/fonts/droid/README.txt +18 -18
  10. package/examples/fonts/ttf/README.md +9 -9
  11. package/examples/jsm/Addons.js +294 -0
  12. package/examples/jsm/animation/AnimationClipCreator.js +116 -116
  13. package/examples/jsm/animation/CCDIKSolver.js +482 -482
  14. package/examples/jsm/animation/MMDAnimationHelper.js +1207 -1207
  15. package/examples/jsm/animation/MMDPhysics.js +1406 -1406
  16. package/examples/jsm/cameras/CinematicCamera.js +208 -208
  17. package/examples/jsm/capabilities/WebGL.js +108 -91
  18. package/examples/jsm/capabilities/WebGPU.js +57 -53
  19. package/examples/jsm/controls/ArcballControls.js +3224 -3224
  20. package/examples/jsm/controls/DragControls.js +221 -220
  21. package/examples/jsm/controls/FirstPersonControls.js +325 -325
  22. package/examples/jsm/controls/FlyControls.js +326 -300
  23. package/examples/jsm/controls/MapControls.js +28 -28
  24. package/examples/jsm/controls/OrbitControls.js +1521 -1279
  25. package/examples/jsm/controls/PointerLockControls.js +162 -162
  26. package/examples/jsm/controls/TrackballControls.js +828 -828
  27. package/examples/jsm/controls/TransformControls.js +1573 -1557
  28. package/examples/jsm/csm/CSM.js +384 -384
  29. package/examples/jsm/csm/CSMFrustum.js +152 -152
  30. package/examples/jsm/csm/CSMHelper.js +193 -193
  31. package/examples/jsm/csm/CSMShader.js +295 -252
  32. package/examples/jsm/curves/CurveExtras.js +422 -422
  33. package/examples/jsm/curves/NURBSCurve.js +80 -80
  34. package/examples/jsm/curves/NURBSSurface.js +52 -52
  35. package/examples/jsm/curves/NURBSUtils.js +487 -487
  36. package/examples/jsm/effects/AnaglyphEffect.js +154 -154
  37. package/examples/jsm/effects/AsciiEffect.js +263 -263
  38. package/examples/jsm/effects/OutlineEffect.js +539 -539
  39. package/examples/jsm/effects/ParallaxBarrierEffect.js +119 -119
  40. package/examples/jsm/effects/PeppersGhostEffect.js +153 -153
  41. package/examples/jsm/effects/StereoEffect.js +55 -55
  42. package/examples/jsm/environments/DebugEnvironment.js +52 -52
  43. package/examples/jsm/environments/RoomEnvironment.js +148 -148
  44. package/examples/jsm/exporters/DRACOExporter.js +267 -267
  45. package/examples/jsm/exporters/EXRExporter.js +579 -501
  46. package/examples/jsm/exporters/GLTFExporter.js +3311 -3163
  47. package/examples/jsm/exporters/KTX2Exporter.js +292 -292
  48. package/examples/jsm/exporters/MMDExporter.js +217 -217
  49. package/examples/jsm/exporters/OBJExporter.js +284 -284
  50. package/examples/jsm/exporters/PLYExporter.js +528 -528
  51. package/examples/jsm/exporters/STLExporter.js +199 -199
  52. package/examples/jsm/exporters/USDZExporter.js +720 -710
  53. package/examples/jsm/geometries/BoxLineGeometry.js +69 -69
  54. package/examples/jsm/geometries/ConvexGeometry.js +53 -53
  55. package/examples/jsm/geometries/DecalGeometry.js +356 -356
  56. package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
  57. package/examples/jsm/geometries/ParametricGeometries.js +254 -254
  58. package/examples/jsm/geometries/ParametricGeometry.js +139 -139
  59. package/examples/jsm/geometries/RoundedBoxGeometry.js +155 -155
  60. package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
  61. package/examples/jsm/geometries/TeapotGeometry.js +704 -704
  62. package/examples/jsm/geometries/TextGeometry.js +57 -57
  63. package/examples/jsm/helpers/LightProbeHelper.js +130 -130
  64. package/examples/jsm/helpers/OctreeHelper.js +73 -73
  65. package/examples/jsm/helpers/PositionalAudioHelper.js +109 -109
  66. package/examples/jsm/helpers/RectAreaLightHelper.js +85 -85
  67. package/examples/jsm/helpers/TextureHelper.js +237 -0
  68. package/examples/jsm/helpers/VertexNormalsHelper.js +96 -96
  69. package/examples/jsm/helpers/VertexTangentsHelper.js +88 -88
  70. package/examples/jsm/helpers/ViewHelper.js +333 -333
  71. package/examples/jsm/interactive/HTMLMesh.js +572 -565
  72. package/examples/jsm/interactive/InteractiveGroup.js +116 -116
  73. package/examples/jsm/interactive/SelectionBox.js +227 -227
  74. package/examples/jsm/interactive/SelectionHelper.js +104 -97
  75. package/examples/jsm/libs/ammo.wasm.js +822 -822
  76. package/examples/jsm/libs/basis/README.md +46 -46
  77. package/examples/jsm/libs/basis/basis_transcoder.js +21 -21
  78. package/examples/jsm/libs/chevrotain.module.min.js +141 -141
  79. package/examples/jsm/libs/draco/README.md +32 -32
  80. package/examples/jsm/libs/draco/draco_decoder.js +34 -34
  81. package/examples/jsm/libs/draco/draco_encoder.js +33 -33
  82. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -117
  83. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -33
  84. package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -33
  85. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -116
  86. package/examples/jsm/libs/ecsy.module.js +1792 -1792
  87. package/examples/jsm/libs/fflate.module.js +2474 -2474
  88. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  89. package/examples/jsm/libs/lil-gui.module.min.js +8 -8
  90. package/examples/jsm/libs/lottie_canvas.module.js +14849 -14844
  91. package/examples/jsm/libs/meshopt_decoder.module.js +178 -178
  92. package/examples/jsm/libs/mikktspace.module.js +128 -128
  93. package/examples/jsm/libs/mmdparser.module.js +11530 -11530
  94. package/examples/jsm/libs/motion-controllers.module.js +397 -397
  95. package/examples/jsm/libs/opentype.module.js +14506 -14568
  96. package/examples/jsm/libs/potpack.module.js +124 -124
  97. package/examples/jsm/libs/rhino3dm/rhino3dm.js +8743 -21
  98. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8748 -15
  99. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  100. package/examples/jsm/libs/stats.module.js +167 -167
  101. package/examples/jsm/libs/surfaceNet.js +201 -0
  102. package/examples/jsm/libs/tween.module.js +858 -803
  103. package/examples/jsm/libs/utif.module.js +1664 -1578
  104. package/examples/jsm/libs/zstddec.module.js +1 -1
  105. package/examples/jsm/lights/IESSpotLight.js +25 -25
  106. package/examples/jsm/lights/LightProbeGenerator.js +286 -252
  107. package/examples/jsm/lights/RectAreaLightUniformsLib.js +79 -79
  108. package/examples/jsm/lines/Line2.js +19 -19
  109. package/examples/jsm/lines/LineGeometry.js +79 -79
  110. package/examples/jsm/lines/LineMaterial.js +619 -702
  111. package/examples/jsm/lines/LineSegments2.js +361 -361
  112. package/examples/jsm/lines/LineSegmentsGeometry.js +241 -241
  113. package/examples/jsm/lines/Wireframe.js +56 -56
  114. package/examples/jsm/lines/WireframeGeometry2.js +24 -24
  115. package/examples/jsm/loaders/3DMLoader.js +1772 -1497
  116. package/examples/jsm/loaders/3MFLoader.js +1478 -1478
  117. package/examples/jsm/loaders/AMFLoader.js +521 -521
  118. package/examples/jsm/loaders/BVHLoader.js +437 -437
  119. package/examples/jsm/loaders/ColladaLoader.js +4116 -4122
  120. package/examples/jsm/loaders/DDSLoader.js +318 -274
  121. package/examples/jsm/loaders/DRACOLoader.js +613 -612
  122. package/examples/jsm/loaders/EXRLoader.js +2309 -2309
  123. package/examples/jsm/loaders/FBXLoader.js +4314 -4142
  124. package/examples/jsm/loaders/FontLoader.js +183 -183
  125. package/examples/jsm/loaders/GCodeLoader.js +261 -261
  126. package/examples/jsm/loaders/GLTFLoader.js +4666 -4579
  127. package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +719 -719
  128. package/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -115
  129. package/examples/jsm/loaders/IESLoader.js +337 -337
  130. package/examples/jsm/loaders/KMZLoader.js +130 -130
  131. package/examples/jsm/loaders/KTX2Loader.js +932 -868
  132. package/examples/jsm/loaders/KTXLoader.js +176 -176
  133. package/examples/jsm/loaders/LDrawLoader.js +2470 -2464
  134. package/examples/jsm/loaders/LUT3dlLoader.js +183 -151
  135. package/examples/jsm/loaders/LUTCubeLoader.js +167 -153
  136. package/examples/jsm/loaders/LUTImageLoader.js +163 -0
  137. package/examples/jsm/loaders/LWOLoader.js +1052 -1052
  138. package/examples/jsm/loaders/LogLuvLoader.js +606 -606
  139. package/examples/jsm/loaders/LottieLoader.js +77 -77
  140. package/examples/jsm/loaders/MD2Loader.js +399 -399
  141. package/examples/jsm/loaders/MDDLoader.js +102 -102
  142. package/examples/jsm/loaders/MMDLoader.js +2276 -2273
  143. package/examples/jsm/loaders/MTLLoader.js +567 -567
  144. package/examples/jsm/loaders/MaterialXLoader.js +852 -734
  145. package/examples/jsm/loaders/NRRDLoader.js +686 -699
  146. package/examples/jsm/loaders/OBJLoader.js +905 -905
  147. package/examples/jsm/loaders/PCDLoader.js +467 -467
  148. package/examples/jsm/loaders/PDBLoader.js +232 -232
  149. package/examples/jsm/loaders/PLYLoader.js +771 -771
  150. package/examples/jsm/loaders/PVRLoader.js +251 -251
  151. package/examples/jsm/loaders/RGBELoader.js +450 -468
  152. package/examples/jsm/loaders/RGBMLoader.js +1065 -1065
  153. package/examples/jsm/loaders/STLLoader.js +410 -403
  154. package/examples/jsm/loaders/SVGLoader.js +3173 -3172
  155. package/examples/jsm/loaders/TDSLoader.js +1124 -1124
  156. package/examples/jsm/loaders/TGALoader.js +517 -517
  157. package/examples/jsm/loaders/TIFFLoader.js +36 -36
  158. package/examples/jsm/loaders/TTFLoader.js +214 -214
  159. package/examples/jsm/loaders/TiltLoader.js +520 -520
  160. package/examples/jsm/loaders/USDZLoader.js +822 -633
  161. package/examples/jsm/loaders/VOXLoader.js +311 -311
  162. package/examples/jsm/loaders/VRMLLoader.js +3533 -3533
  163. package/examples/jsm/loaders/VTKLoader.js +1163 -1163
  164. package/examples/jsm/loaders/XYZLoader.js +106 -106
  165. package/examples/jsm/loaders/lwo/IFFParser.js +1214 -1218
  166. package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -414
  167. package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -373
  168. package/examples/jsm/materials/MeshGouraudMaterial.js +426 -420
  169. package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
  170. package/examples/jsm/math/Capsule.js +82 -137
  171. package/examples/jsm/math/ColorConverter.js +36 -36
  172. package/examples/jsm/math/ConvexHull.js +1271 -1271
  173. package/examples/jsm/math/ImprovedNoise.js +71 -71
  174. package/examples/jsm/math/Lut.js +204 -204
  175. package/examples/jsm/math/MeshSurfaceSampler.js +250 -250
  176. package/examples/jsm/math/OBB.js +423 -423
  177. package/examples/jsm/math/Octree.js +540 -462
  178. package/examples/jsm/math/SimplexNoise.js +444 -444
  179. package/examples/jsm/misc/ConvexObjectBreaker.js +519 -519
  180. package/examples/jsm/misc/GPUComputationRenderer.js +446 -455
  181. package/examples/jsm/misc/Gyroscope.js +66 -66
  182. package/examples/jsm/misc/MD2Character.js +276 -276
  183. package/examples/jsm/misc/MD2CharacterComplex.js +576 -576
  184. package/examples/jsm/misc/MorphAnimMesh.js +75 -75
  185. package/examples/jsm/misc/MorphBlendMesh.js +322 -322
  186. package/examples/jsm/misc/ProgressiveLightMap.js +323 -323
  187. package/examples/jsm/misc/RollerCoaster.js +566 -566
  188. package/examples/jsm/misc/Timer.js +119 -0
  189. package/examples/jsm/misc/TubePainter.js +202 -205
  190. package/examples/jsm/misc/Volume.js +473 -475
  191. package/examples/jsm/misc/VolumeSlice.js +229 -229
  192. package/examples/jsm/modifiers/CurveModifier.js +344 -326
  193. package/examples/jsm/modifiers/EdgeSplitModifier.js +279 -279
  194. package/examples/jsm/modifiers/SimplifyModifier.js +617 -525
  195. package/examples/jsm/modifiers/TessellateModifier.js +307 -307
  196. package/examples/jsm/nodes/Nodes.js +189 -172
  197. package/examples/jsm/nodes/accessors/BitangentNode.js +89 -89
  198. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +127 -99
  199. package/examples/jsm/nodes/accessors/BufferNode.js +30 -30
  200. package/examples/jsm/nodes/accessors/CameraNode.js +120 -98
  201. package/examples/jsm/nodes/accessors/CubeTextureNode.js +61 -101
  202. package/examples/jsm/nodes/accessors/InstanceNode.js +71 -71
  203. package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
  204. package/examples/jsm/nodes/accessors/MaterialNode.js +314 -277
  205. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +51 -39
  206. package/examples/jsm/nodes/accessors/ModelNode.js +33 -34
  207. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +39 -29
  208. package/examples/jsm/nodes/accessors/MorphNode.js +245 -70
  209. package/examples/jsm/nodes/accessors/NormalNode.js +96 -96
  210. package/examples/jsm/nodes/accessors/Object3DNode.js +150 -150
  211. package/examples/jsm/nodes/accessors/PointUVNode.js +26 -26
  212. package/examples/jsm/nodes/accessors/PositionNode.js +104 -104
  213. package/examples/jsm/nodes/accessors/ReferenceNode.js +102 -72
  214. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +35 -35
  215. package/examples/jsm/nodes/accessors/SceneNode.js +52 -46
  216. package/examples/jsm/nodes/accessors/SkinningNode.js +103 -93
  217. package/examples/jsm/nodes/accessors/StorageBufferNode.js +54 -27
  218. package/examples/jsm/nodes/accessors/TangentNode.js +103 -103
  219. package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -94
  220. package/examples/jsm/nodes/accessors/TextureNode.js +367 -230
  221. package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -35
  222. package/examples/jsm/nodes/accessors/TextureStoreNode.js +82 -0
  223. package/examples/jsm/nodes/accessors/UVNode.js +47 -47
  224. package/examples/jsm/nodes/accessors/UserDataNode.js +29 -29
  225. package/examples/jsm/nodes/accessors/VertexColorNode.js +70 -0
  226. package/examples/jsm/nodes/code/CodeNode.js +78 -78
  227. package/examples/jsm/nodes/code/ExpressionNode.js +37 -37
  228. package/examples/jsm/nodes/code/FunctionCallNode.js +96 -96
  229. package/examples/jsm/nodes/code/FunctionNode.js +138 -127
  230. package/examples/jsm/nodes/code/ScriptableNode.js +488 -488
  231. package/examples/jsm/nodes/code/ScriptableValueNode.js +167 -167
  232. package/examples/jsm/nodes/core/ArrayUniformNode.js +26 -26
  233. package/examples/jsm/nodes/core/AssignNode.js +72 -0
  234. package/examples/jsm/nodes/core/AttributeNode.js +108 -102
  235. package/examples/jsm/nodes/core/BypassNode.js +45 -45
  236. package/examples/jsm/nodes/core/CacheNode.js +49 -46
  237. package/examples/jsm/nodes/core/ConstNode.js +32 -32
  238. package/examples/jsm/nodes/core/ContextNode.js +61 -61
  239. package/examples/jsm/nodes/core/IndexNode.js +66 -66
  240. package/examples/jsm/nodes/core/InputNode.js +83 -83
  241. package/examples/jsm/nodes/core/LightingModel.js +17 -17
  242. package/examples/jsm/nodes/core/Node.js +483 -445
  243. package/examples/jsm/nodes/core/NodeAttribute.js +15 -15
  244. package/examples/jsm/nodes/core/NodeBuilder.js +1267 -1016
  245. package/examples/jsm/nodes/core/NodeCache.js +26 -26
  246. package/examples/jsm/nodes/core/NodeCode.js +15 -15
  247. package/examples/jsm/nodes/core/NodeFrame.js +135 -110
  248. package/examples/jsm/nodes/core/NodeFunction.js +22 -22
  249. package/examples/jsm/nodes/core/NodeFunctionInput.js +17 -17
  250. package/examples/jsm/nodes/core/NodeKeywords.js +80 -80
  251. package/examples/jsm/nodes/core/NodeParser.js +11 -11
  252. package/examples/jsm/nodes/core/NodeUniform.js +40 -28
  253. package/examples/jsm/nodes/core/NodeUtils.js +210 -212
  254. package/examples/jsm/nodes/core/NodeVar.js +14 -14
  255. package/examples/jsm/nodes/core/NodeVarying.js +17 -17
  256. package/examples/jsm/nodes/core/OutputStructNode.js +62 -0
  257. package/examples/jsm/nodes/core/ParameterNode.js +33 -0
  258. package/examples/jsm/nodes/core/PropertyNode.js +72 -57
  259. package/examples/jsm/nodes/core/StackNode.js +89 -99
  260. package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
  261. package/examples/jsm/nodes/core/TempNode.js +58 -58
  262. package/examples/jsm/nodes/core/UniformGroup.js +13 -0
  263. package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
  264. package/examples/jsm/nodes/core/UniformNode.js +80 -61
  265. package/examples/jsm/nodes/core/VarNode.js +60 -87
  266. package/examples/jsm/nodes/core/VaryingNode.js +65 -69
  267. package/examples/jsm/nodes/core/constants.js +27 -27
  268. package/examples/jsm/nodes/display/AfterImageNode.js +134 -0
  269. package/examples/jsm/nodes/display/BlendModeNode.js +99 -99
  270. package/examples/jsm/nodes/display/BumpMapNode.js +99 -0
  271. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +96 -100
  272. package/examples/jsm/nodes/display/ColorSpaceNode.js +108 -108
  273. package/examples/jsm/nodes/display/FrontFacingNode.js +27 -27
  274. package/examples/jsm/nodes/display/GaussianBlurNode.js +177 -0
  275. package/examples/jsm/nodes/display/NormalMapNode.js +108 -106
  276. package/examples/jsm/nodes/display/PassNode.js +182 -0
  277. package/examples/jsm/nodes/display/PosterizeNode.js +32 -32
  278. package/examples/jsm/nodes/display/ToneMappingNode.js +184 -141
  279. package/examples/jsm/nodes/display/ViewportDepthNode.js +97 -69
  280. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +31 -34
  281. package/examples/jsm/nodes/display/ViewportNode.js +134 -115
  282. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +31 -31
  283. package/examples/jsm/nodes/display/ViewportTextureNode.js +75 -75
  284. package/examples/jsm/nodes/fog/FogExp2Node.js +35 -35
  285. package/examples/jsm/nodes/fog/FogNode.js +38 -37
  286. package/examples/jsm/nodes/fog/FogRangeNode.js +34 -34
  287. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +40 -32
  288. package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -9
  289. package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +57 -43
  290. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +30 -29
  291. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +23 -18
  292. package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -13
  293. package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +16 -16
  294. package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
  295. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +28 -20
  296. package/examples/jsm/nodes/functions/PhongLightingModel.js +67 -28
  297. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +393 -204
  298. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +13 -13
  299. package/examples/jsm/nodes/functions/material/getRoughness.js +18 -18
  300. package/examples/jsm/nodes/geometry/RangeNode.js +104 -104
  301. package/examples/jsm/nodes/gpgpu/ComputeNode.js +85 -72
  302. package/examples/jsm/nodes/lighting/AONode.js +27 -27
  303. package/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -27
  304. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +238 -146
  305. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +40 -43
  306. package/examples/jsm/nodes/lighting/EnvironmentNode.js +181 -181
  307. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +55 -55
  308. package/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -39
  309. package/examples/jsm/nodes/lighting/LightNode.js +57 -57
  310. package/examples/jsm/nodes/lighting/LightUtils.js +17 -17
  311. package/examples/jsm/nodes/lighting/LightingContextNode.js +66 -99
  312. package/examples/jsm/nodes/lighting/LightingNode.js +21 -21
  313. package/examples/jsm/nodes/lighting/LightsNode.js +188 -128
  314. package/examples/jsm/nodes/lighting/PointLightNode.js +68 -71
  315. package/examples/jsm/nodes/lighting/SpotLightNode.js +89 -92
  316. package/examples/jsm/nodes/loaders/NodeLoader.js +108 -108
  317. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +59 -59
  318. package/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -70
  319. package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
  320. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +436 -0
  321. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +28 -28
  322. package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
  323. package/examples/jsm/nodes/materials/Materials.js +16 -11
  324. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +28 -27
  325. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -0
  326. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +40 -38
  327. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +65 -65
  328. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +155 -111
  329. package/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -0
  330. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +80 -80
  331. package/examples/jsm/nodes/materials/NodeMaterial.js +568 -510
  332. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +39 -49
  333. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +96 -103
  334. package/examples/jsm/nodes/materialx/DISCLAIMER.md +199 -199
  335. package/examples/jsm/nodes/materialx/MaterialXNodes.js +68 -68
  336. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +130 -56
  337. package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
  338. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +29 -19
  339. package/examples/jsm/nodes/math/CondNode.js +86 -86
  340. package/examples/jsm/nodes/math/HashNode.js +34 -0
  341. package/examples/jsm/nodes/math/MathNode.js +382 -359
  342. package/examples/jsm/nodes/math/OperatorNode.js +266 -269
  343. package/examples/jsm/nodes/math/TriNoise3D.js +71 -0
  344. package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +152 -152
  345. package/examples/jsm/nodes/parsers/GLSLNodeParser.js +14 -14
  346. package/examples/jsm/nodes/procedural/CheckerNode.js +42 -42
  347. package/examples/jsm/nodes/shadernode/ShaderNode.js +625 -420
  348. package/examples/jsm/nodes/utils/ArrayElementNode.js +41 -33
  349. package/examples/jsm/nodes/utils/ConvertNode.js +65 -65
  350. package/examples/jsm/nodes/utils/DiscardNode.js +27 -26
  351. package/examples/jsm/nodes/utils/EquirectUVNode.js +33 -33
  352. package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
  353. package/examples/jsm/nodes/utils/JoinNode.js +61 -51
  354. package/examples/jsm/nodes/utils/LoopNode.js +198 -186
  355. package/examples/jsm/nodes/utils/MatcapUVNode.js +30 -30
  356. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +46 -46
  357. package/examples/jsm/nodes/utils/OscNode.js +81 -81
  358. package/examples/jsm/nodes/utils/PackingNode.js +55 -55
  359. package/examples/jsm/nodes/utils/RemapNode.js +42 -42
  360. package/examples/jsm/nodes/utils/RotateNode.js +43 -0
  361. package/examples/jsm/nodes/utils/RotateUVNode.js +43 -43
  362. package/examples/jsm/nodes/utils/SetNode.js +62 -0
  363. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -37
  364. package/examples/jsm/nodes/utils/SplitNode.js +112 -104
  365. package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +41 -41
  366. package/examples/jsm/nodes/utils/TimerNode.js +94 -94
  367. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +62 -62
  368. package/examples/jsm/objects/GroundedSkybox.js +50 -0
  369. package/examples/jsm/objects/InstancedPoints.js +21 -0
  370. package/examples/jsm/objects/Lensflare.js +397 -377
  371. package/examples/jsm/objects/MarchingCubes.js +1176 -1176
  372. package/examples/jsm/objects/QuadMesh.js +66 -0
  373. package/examples/jsm/objects/Reflector.js +264 -272
  374. package/examples/jsm/objects/ReflectorForSSRPass.js +352 -349
  375. package/examples/jsm/objects/Refractor.js +327 -332
  376. package/examples/jsm/objects/ShadowMesh.js +80 -80
  377. package/examples/jsm/objects/Sky.js +219 -219
  378. package/examples/jsm/objects/Water.js +333 -330
  379. package/examples/jsm/objects/Water2.js +361 -358
  380. package/examples/jsm/offscreen/jank.js +45 -45
  381. package/examples/jsm/offscreen/offscreen.js +8 -8
  382. package/examples/jsm/offscreen/scene.js +86 -87
  383. package/examples/jsm/physics/AmmoPhysics.js +306 -285
  384. package/examples/jsm/physics/RapierPhysics.js +220 -199
  385. package/examples/jsm/postprocessing/AfterimagePass.js +104 -104
  386. package/examples/jsm/postprocessing/BloomPass.js +172 -172
  387. package/examples/jsm/postprocessing/BokehPass.js +141 -140
  388. package/examples/jsm/postprocessing/ClearPass.js +46 -46
  389. package/examples/jsm/postprocessing/CubeTexturePass.js +85 -85
  390. package/examples/jsm/postprocessing/DotScreenPass.js +65 -65
  391. package/examples/jsm/postprocessing/EffectComposer.js +231 -231
  392. package/examples/jsm/postprocessing/FilmPass.js +64 -66
  393. package/examples/jsm/postprocessing/GTAOPass.js +582 -0
  394. package/examples/jsm/postprocessing/GlitchPass.js +128 -128
  395. package/examples/jsm/postprocessing/HalftonePass.js +79 -79
  396. package/examples/jsm/postprocessing/LUTPass.js +174 -173
  397. package/examples/jsm/postprocessing/MaskPass.js +104 -101
  398. package/examples/jsm/postprocessing/OutlinePass.js +654 -654
  399. package/examples/jsm/postprocessing/OutputPass.js +95 -72
  400. package/examples/jsm/postprocessing/Pass.js +95 -84
  401. package/examples/jsm/postprocessing/RenderPass.js +99 -81
  402. package/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -235
  403. package/examples/jsm/postprocessing/SAOPass.js +335 -411
  404. package/examples/jsm/postprocessing/SMAAPass.js +199 -201
  405. package/examples/jsm/postprocessing/SSAARenderPass.js +228 -228
  406. package/examples/jsm/postprocessing/SSAOPass.js +420 -440
  407. package/examples/jsm/postprocessing/SSRPass.js +641 -641
  408. package/examples/jsm/postprocessing/SavePass.js +79 -79
  409. package/examples/jsm/postprocessing/ShaderPass.js +77 -77
  410. package/examples/jsm/postprocessing/TAARenderPass.js +188 -189
  411. package/examples/jsm/postprocessing/TexturePass.js +67 -67
  412. package/examples/jsm/postprocessing/UnrealBloomPass.js +415 -411
  413. package/examples/jsm/renderers/CSS2DRenderer.js +215 -215
  414. package/examples/jsm/renderers/CSS3DRenderer.js +329 -335
  415. package/examples/jsm/renderers/Projector.js +918 -918
  416. package/examples/jsm/renderers/SVGRenderer.js +556 -553
  417. package/examples/jsm/renderers/common/Animation.js +47 -58
  418. package/examples/jsm/renderers/common/Attributes.js +75 -75
  419. package/examples/jsm/renderers/common/Backend.js +193 -162
  420. package/examples/jsm/renderers/common/Background.js +134 -134
  421. package/examples/jsm/renderers/common/Binding.js +25 -11
  422. package/examples/jsm/renderers/common/Bindings.js +173 -169
  423. package/examples/jsm/renderers/common/Buffer.js +38 -38
  424. package/examples/jsm/renderers/common/BufferUtils.js +33 -33
  425. package/examples/jsm/renderers/common/ChainMap.js +89 -89
  426. package/examples/jsm/renderers/common/Color4.js +37 -0
  427. package/examples/jsm/renderers/common/ComputePipeline.js +17 -17
  428. package/examples/jsm/renderers/common/Constants.js +14 -14
  429. package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -65
  430. package/examples/jsm/renderers/common/DataMap.js +54 -54
  431. package/examples/jsm/renderers/common/Geometries.js +215 -215
  432. package/examples/jsm/renderers/common/Info.js +107 -73
  433. package/examples/jsm/renderers/common/Pipeline.js +13 -13
  434. package/examples/jsm/renderers/common/Pipelines.js +322 -321
  435. package/examples/jsm/renderers/common/PostProcessing.js +25 -0
  436. package/examples/jsm/renderers/common/ProgrammableStage.js +20 -18
  437. package/examples/jsm/renderers/common/RenderContext.js +41 -37
  438. package/examples/jsm/renderers/common/RenderContexts.js +74 -38
  439. package/examples/jsm/renderers/common/RenderList.js +186 -178
  440. package/examples/jsm/renderers/common/RenderLists.js +38 -38
  441. package/examples/jsm/renderers/common/RenderObject.js +178 -113
  442. package/examples/jsm/renderers/common/RenderObjects.js +91 -92
  443. package/examples/jsm/renderers/common/RenderPipeline.js +16 -16
  444. package/examples/jsm/renderers/common/Renderer.js +1062 -864
  445. package/examples/jsm/renderers/common/SampledTexture.js +83 -80
  446. package/examples/jsm/renderers/common/Sampler.js +18 -18
  447. package/examples/jsm/renderers/common/StorageBuffer.js +17 -17
  448. package/examples/jsm/renderers/common/StorageBufferAttribute.js +21 -0
  449. package/examples/jsm/renderers/common/StorageTexture.js +20 -0
  450. package/examples/jsm/renderers/common/Textures.js +354 -206
  451. package/examples/jsm/renderers/common/Uniform.js +140 -140
  452. package/examples/jsm/renderers/common/UniformBuffer.js +15 -15
  453. package/examples/jsm/renderers/common/UniformsGroup.js +299 -299
  454. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +44 -0
  455. package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +49 -39
  456. package/examples/jsm/renderers/common/nodes/NodeSampler.js +15 -21
  457. package/examples/jsm/renderers/common/nodes/NodeUniform.js +135 -135
  458. package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
  459. package/examples/jsm/renderers/common/nodes/Nodes.js +495 -319
  460. package/examples/jsm/renderers/webgl/WebGLBackend.js +1290 -0
  461. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +679 -340
  462. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +252 -0
  463. package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
  464. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -0
  465. package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +36 -0
  466. package/examples/jsm/renderers/webgl/utils/WebGLState.js +738 -0
  467. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +647 -0
  468. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +284 -0
  469. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +320 -0
  470. package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +26 -26
  471. package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +794 -764
  472. package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +51 -49
  473. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +1321 -847
  474. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +53 -32
  475. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +1098 -878
  476. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +104 -104
  477. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.js +14 -14
  478. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +287 -255
  479. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +244 -145
  480. package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +324 -322
  481. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +570 -580
  482. package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
  483. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +1040 -937
  484. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +93 -92
  485. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +89 -87
  486. package/examples/jsm/shaders/AfterimageShader.js +58 -56
  487. package/examples/jsm/shaders/BasicShader.js +29 -27
  488. package/examples/jsm/shaders/BleachBypassShader.js +62 -62
  489. package/examples/jsm/shaders/BlendShader.js +49 -47
  490. package/examples/jsm/shaders/BokehShader.js +145 -143
  491. package/examples/jsm/shaders/BokehShader2.js +397 -393
  492. package/examples/jsm/shaders/BrightnessContrastShader.js +56 -54
  493. package/examples/jsm/shaders/ColorCorrectionShader.js +52 -50
  494. package/examples/jsm/shaders/ColorifyShader.js +51 -51
  495. package/examples/jsm/shaders/ConvolutionShader.js +103 -103
  496. package/examples/jsm/shaders/CopyShader.js +45 -45
  497. package/examples/jsm/shaders/DOFMipMapShader.js +56 -54
  498. package/examples/jsm/shaders/DepthLimitedBlurShader.js +171 -166
  499. package/examples/jsm/shaders/DigitalGlitch.js +101 -101
  500. package/examples/jsm/shaders/DotScreenShader.js +70 -70
  501. package/examples/jsm/shaders/ExposureShader.js +44 -44
  502. package/examples/jsm/shaders/FXAAShader.js +288 -286
  503. package/examples/jsm/shaders/FilmShader.js +59 -102
  504. package/examples/jsm/shaders/FocusShader.js +89 -87
  505. package/examples/jsm/shaders/FreiChenShader.js +96 -94
  506. package/examples/jsm/shaders/GTAOShader.js +424 -0
  507. package/examples/jsm/shaders/GammaCorrectionShader.js +43 -43
  508. package/examples/jsm/shaders/GodRaysShader.js +321 -313
  509. package/examples/jsm/shaders/HalftoneShader.js +312 -310
  510. package/examples/jsm/shaders/HorizontalBlurShader.js +59 -59
  511. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +63 -61
  512. package/examples/jsm/shaders/HueSaturationShader.js +67 -65
  513. package/examples/jsm/shaders/KaleidoShader.js +58 -56
  514. package/examples/jsm/shaders/LuminosityHighPassShader.js +66 -64
  515. package/examples/jsm/shaders/LuminosityShader.js +48 -46
  516. package/examples/jsm/shaders/MMDToonShader.js +134 -132
  517. package/examples/jsm/shaders/MirrorShader.js +56 -54
  518. package/examples/jsm/shaders/NormalMapShader.js +55 -53
  519. package/examples/jsm/shaders/OutputShader.js +81 -61
  520. package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
  521. package/examples/jsm/shaders/RGBShiftShader.js +54 -54
  522. package/examples/jsm/shaders/SAOShader.js +179 -188
  523. package/examples/jsm/shaders/SMAAShader.js +466 -460
  524. package/examples/jsm/shaders/SSAOShader.js +300 -288
  525. package/examples/jsm/shaders/SSRShader.js +370 -364
  526. package/examples/jsm/shaders/SepiaShader.js +52 -52
  527. package/examples/jsm/shaders/SobelOperatorShader.js +92 -90
  528. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +90 -88
  529. package/examples/jsm/shaders/TechnicolorShader.js +45 -43
  530. package/examples/jsm/shaders/ToonShader.js +326 -326
  531. package/examples/jsm/shaders/TriangleBlurShader.js +74 -72
  532. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +47 -45
  533. package/examples/jsm/shaders/VelocityShader.js +130 -128
  534. package/examples/jsm/shaders/VerticalBlurShader.js +59 -59
  535. package/examples/jsm/shaders/VerticalTiltShiftShader.js +63 -61
  536. package/examples/jsm/shaders/VignetteShader.js +51 -51
  537. package/examples/jsm/shaders/VolumeShader.js +289 -289
  538. package/examples/jsm/shaders/WaterRefractionShader.js +95 -93
  539. package/examples/jsm/textures/FlakesTexture.js +40 -40
  540. package/examples/jsm/transpiler/AST.js +270 -0
  541. package/examples/jsm/transpiler/GLSLDecoder.js +941 -0
  542. package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
  543. package/examples/jsm/transpiler/TSLEncoder.js +715 -0
  544. package/examples/jsm/transpiler/Transpiler.js +18 -0
  545. package/examples/jsm/utils/BufferGeometryUtils.js +1371 -1364
  546. package/examples/jsm/utils/CameraUtils.js +73 -73
  547. package/examples/jsm/utils/GPUStatsPanel.js +128 -128
  548. package/examples/jsm/utils/GeometryCompressionUtils.js +639 -639
  549. package/examples/jsm/utils/GeometryUtils.js +221 -221
  550. package/examples/jsm/utils/LDrawUtils.js +202 -202
  551. package/examples/jsm/utils/PackedPhongMaterial.js +178 -178
  552. package/examples/jsm/utils/SceneUtils.js +254 -254
  553. package/examples/jsm/utils/ShadowMapViewer.js +210 -210
  554. package/examples/jsm/utils/SkeletonUtils.js +413 -413
  555. package/examples/jsm/utils/SortUtils.js +160 -0
  556. package/examples/jsm/utils/TextureUtils.js +98 -86
  557. package/examples/jsm/utils/UVsDebug.js +165 -165
  558. package/examples/jsm/utils/WorkerPool.js +102 -102
  559. package/examples/jsm/webxr/ARButton.js +232 -208
  560. package/examples/jsm/webxr/OculusHandModel.js +109 -109
  561. package/examples/jsm/webxr/OculusHandPointerModel.js +416 -415
  562. package/examples/jsm/webxr/Text2D.js +38 -38
  563. package/examples/jsm/webxr/VRButton.js +225 -200
  564. package/examples/jsm/webxr/XRButton.js +224 -198
  565. package/examples/jsm/webxr/XRControllerModelFactory.js +315 -310
  566. package/examples/jsm/webxr/XREstimatedLight.js +223 -223
  567. package/examples/jsm/webxr/XRHandMeshModel.js +116 -113
  568. package/examples/jsm/webxr/XRHandModelFactory.js +105 -105
  569. package/examples/jsm/webxr/XRHandPrimitiveModel.js +105 -104
  570. package/examples/jsm/webxr/XRPlanes.js +100 -100
  571. package/package.json +129 -126
  572. package/src/Three.Legacy.js +1 -1
  573. package/src/Three.js +184 -182
  574. package/src/animation/AnimationAction.js +700 -700
  575. package/src/animation/AnimationClip.js +473 -473
  576. package/src/animation/AnimationMixer.js +770 -770
  577. package/src/animation/AnimationObjectGroup.js +387 -387
  578. package/src/animation/AnimationUtils.js +356 -373
  579. package/src/animation/KeyframeTrack.js +462 -462
  580. package/src/animation/PropertyBinding.js +719 -719
  581. package/src/animation/PropertyMixer.js +318 -318
  582. package/src/animation/tracks/BooleanKeyframeTrack.js +19 -19
  583. package/src/animation/tracks/ColorKeyframeTrack.js +15 -15
  584. package/src/animation/tracks/NumberKeyframeTrack.js +12 -12
  585. package/src/animation/tracks/QuaternionKeyframeTrack.js +23 -23
  586. package/src/animation/tracks/StringKeyframeTrack.js +15 -15
  587. package/src/animation/tracks/VectorKeyframeTrack.js +12 -12
  588. package/src/audio/Audio.js +400 -396
  589. package/src/audio/AudioAnalyser.js +40 -40
  590. package/src/audio/AudioContext.js +25 -25
  591. package/src/audio/AudioListener.js +140 -137
  592. package/src/audio/PositionalAudio.js +146 -146
  593. package/src/cameras/ArrayCamera.js +17 -17
  594. package/src/cameras/Camera.js +69 -73
  595. package/src/cameras/CubeCamera.js +173 -170
  596. package/src/cameras/OrthographicCamera.js +136 -136
  597. package/src/cameras/PerspectiveCamera.js +268 -233
  598. package/src/cameras/StereoCamera.js +100 -100
  599. package/src/constants.js +216 -201
  600. package/src/core/BufferAttribute.js +650 -610
  601. package/src/core/BufferGeometry.js +1079 -1079
  602. package/src/core/Clock.js +74 -74
  603. package/src/core/EventDispatcher.js +87 -87
  604. package/src/core/GLBufferAttribute.js +60 -60
  605. package/src/core/InstancedBufferAttribute.js +39 -39
  606. package/src/core/InstancedBufferGeometry.js +40 -40
  607. package/src/core/InstancedInterleavedBuffer.js +48 -48
  608. package/src/core/InterleavedBuffer.js +166 -145
  609. package/src/core/InterleavedBufferAttribute.js +351 -331
  610. package/src/core/Layers.js +60 -60
  611. package/src/core/Object3D.js +1008 -973
  612. package/src/core/Raycaster.js +110 -110
  613. package/src/core/RenderTarget.js +131 -0
  614. package/src/core/Uniform.js +17 -17
  615. package/src/core/UniformsGroup.js +98 -92
  616. package/src/extras/DataUtils.js +176 -176
  617. package/src/extras/Earcut.js +789 -789
  618. package/src/extras/ImageUtils.js +129 -129
  619. package/src/extras/PMREMGenerator.js +910 -903
  620. package/src/extras/ShapeUtils.js +92 -92
  621. package/src/extras/core/Curve.js +416 -416
  622. package/src/extras/core/CurvePath.js +255 -252
  623. package/src/extras/core/Interpolations.js +79 -79
  624. package/src/extras/core/Path.js +196 -196
  625. package/src/extras/core/Shape.js +102 -102
  626. package/src/extras/core/ShapePath.js +291 -291
  627. package/src/extras/curves/ArcCurve.js +17 -17
  628. package/src/extras/curves/CatmullRomCurve3.js +255 -255
  629. package/src/extras/curves/CubicBezierCurve.js +78 -78
  630. package/src/extras/curves/CubicBezierCurve3.js +79 -79
  631. package/src/extras/curves/Curves.js +10 -10
  632. package/src/extras/curves/EllipseCurve.js +156 -156
  633. package/src/extras/curves/LineCurve.js +92 -92
  634. package/src/extras/curves/LineCurve3.js +92 -88
  635. package/src/extras/curves/QuadraticBezierCurve.js +74 -74
  636. package/src/extras/curves/QuadraticBezierCurve3.js +75 -75
  637. package/src/extras/curves/SplineCurve.js +97 -97
  638. package/src/geometries/BoxGeometry.js +180 -180
  639. package/src/geometries/CapsuleGeometry.js +33 -33
  640. package/src/geometries/CircleGeometry.js +101 -101
  641. package/src/geometries/ConeGeometry.js +31 -31
  642. package/src/geometries/CylinderGeometry.js +286 -286
  643. package/src/geometries/DodecahedronGeometry.js +66 -66
  644. package/src/geometries/EdgesGeometry.js +152 -152
  645. package/src/geometries/ExtrudeGeometry.js +814 -814
  646. package/src/geometries/Geometries.js +21 -21
  647. package/src/geometries/IcosahedronGeometry.js +42 -42
  648. package/src/geometries/LatheGeometry.js +189 -189
  649. package/src/geometries/OctahedronGeometry.js +37 -37
  650. package/src/geometries/PlaneGeometry.js +98 -98
  651. package/src/geometries/PolyhedronGeometry.js +319 -319
  652. package/src/geometries/RingGeometry.js +128 -128
  653. package/src/geometries/ShapeGeometry.js +195 -195
  654. package/src/geometries/SphereGeometry.js +137 -137
  655. package/src/geometries/TetrahedronGeometry.js +34 -34
  656. package/src/geometries/TorusGeometry.js +120 -120
  657. package/src/geometries/TorusKnotGeometry.js +167 -167
  658. package/src/geometries/TubeGeometry.js +203 -203
  659. package/src/geometries/WireframeGeometry.js +147 -147
  660. package/src/helpers/ArrowHelper.js +114 -114
  661. package/src/helpers/AxesHelper.js +68 -68
  662. package/src/helpers/Box3Helper.js +55 -55
  663. package/src/helpers/BoxHelper.js +113 -113
  664. package/src/helpers/CameraHelper.js +269 -269
  665. package/src/helpers/DirectionalLightHelper.js +93 -93
  666. package/src/helpers/GridHelper.js +56 -56
  667. package/src/helpers/HemisphereLightHelper.js +88 -88
  668. package/src/helpers/PlaneHelper.js +63 -63
  669. package/src/helpers/PointLightHelper.js +92 -92
  670. package/src/helpers/PolarGridHelper.js +96 -96
  671. package/src/helpers/SkeletonHelper.js +128 -128
  672. package/src/helpers/SpotLightHelper.js +94 -94
  673. package/src/lights/AmbientLight.js +17 -17
  674. package/src/lights/DirectionalLight.js +43 -43
  675. package/src/lights/DirectionalLightShadow.js +16 -16
  676. package/src/lights/HemisphereLight.js +34 -34
  677. package/src/lights/Light.js +58 -58
  678. package/src/lights/LightProbe.js +47 -47
  679. package/src/lights/LightShadow.js +147 -147
  680. package/src/lights/PointLight.js +57 -57
  681. package/src/lights/PointLightShadow.js +96 -96
  682. package/src/lights/RectAreaLight.js +56 -56
  683. package/src/lights/SpotLight.js +71 -71
  684. package/src/lights/SpotLightShadow.js +50 -50
  685. package/src/loaders/AnimationLoader.js +66 -66
  686. package/src/loaders/AudioLoader.js +66 -66
  687. package/src/loaders/BufferGeometryLoader.js +217 -224
  688. package/src/loaders/Cache.js +42 -42
  689. package/src/loaders/CompressedTextureLoader.js +134 -134
  690. package/src/loaders/CubeTextureLoader.js +58 -58
  691. package/src/loaders/DataTextureLoader.js +135 -118
  692. package/src/loaders/FileLoader.js +284 -284
  693. package/src/loaders/ImageBitmapLoader.js +123 -99
  694. package/src/loaders/ImageLoader.js +91 -91
  695. package/src/loaders/Loader.js +72 -72
  696. package/src/loaders/LoaderUtils.js +75 -75
  697. package/src/loaders/LoadingManager.js +142 -142
  698. package/src/loaders/MaterialLoader.js +372 -364
  699. package/src/loaders/ObjectLoader.js +1148 -1093
  700. package/src/loaders/TextureLoader.js +41 -41
  701. package/src/materials/LineBasicMaterial.js +53 -49
  702. package/src/materials/LineDashedMaterial.js +35 -35
  703. package/src/materials/Material.js +522 -508
  704. package/src/materials/Materials.js +39 -39
  705. package/src/materials/MeshBasicMaterial.js +85 -81
  706. package/src/materials/MeshDepthMaterial.js +54 -54
  707. package/src/materials/MeshDistanceMaterial.js +43 -43
  708. package/src/materials/MeshLambertMaterial.js +120 -116
  709. package/src/materials/MeshMatcapMaterial.js +85 -81
  710. package/src/materials/MeshNormalMaterial.js +61 -61
  711. package/src/materials/MeshPhongMaterial.js +124 -120
  712. package/src/materials/MeshPhysicalMaterial.js +224 -224
  713. package/src/materials/MeshStandardMaterial.js +128 -124
  714. package/src/materials/MeshToonMaterial.js +106 -102
  715. package/src/materials/PointsMaterial.js +54 -50
  716. package/src/materials/RawShaderMaterial.js +17 -17
  717. package/src/materials/ShaderMaterial.js +190 -187
  718. package/src/materials/ShadowMaterial.js +37 -37
  719. package/src/materials/SpriteMaterial.js +54 -54
  720. package/src/math/Box2.js +204 -204
  721. package/src/math/Box3.js +534 -517
  722. package/src/math/Color.js +623 -627
  723. package/src/math/ColorManagement.js +139 -133
  724. package/src/math/Cylindrical.js +61 -61
  725. package/src/math/Euler.js +315 -315
  726. package/src/math/Frustum.js +186 -186
  727. package/src/math/Interpolant.js +241 -241
  728. package/src/math/Line3.js +115 -115
  729. package/src/math/MathUtils.js +363 -363
  730. package/src/math/Matrix3.js +388 -388
  731. package/src/math/Matrix4.js +915 -915
  732. package/src/math/Plane.js +205 -205
  733. package/src/math/Quaternion.js +685 -684
  734. package/src/math/Ray.js +493 -493
  735. package/src/math/Sphere.js +245 -243
  736. package/src/math/Spherical.js +86 -86
  737. package/src/math/SphericalHarmonics3.js +243 -243
  738. package/src/math/Triangle.js +311 -329
  739. package/src/math/Vector2.js +480 -480
  740. package/src/math/Vector3.js +724 -725
  741. package/src/math/Vector4.js +644 -644
  742. package/src/math/interpolants/CubicInterpolant.js +150 -150
  743. package/src/math/interpolants/DiscreteInterpolant.js +26 -26
  744. package/src/math/interpolants/LinearInterpolant.js +38 -38
  745. package/src/math/interpolants/QuaternionLinearInterpolant.js +39 -39
  746. package/src/objects/BatchedMesh.js +1019 -0
  747. package/src/objects/Bone.js +17 -17
  748. package/src/objects/Group.js +17 -17
  749. package/src/objects/InstancedMesh.js +214 -214
  750. package/src/objects/LOD.js +214 -214
  751. package/src/objects/Line.js +222 -222
  752. package/src/objects/LineLoop.js +17 -17
  753. package/src/objects/LineSegments.js +55 -55
  754. package/src/objects/Mesh.js +429 -429
  755. package/src/objects/Points.js +166 -166
  756. package/src/objects/Skeleton.js +277 -279
  757. package/src/objects/SkinnedMesh.js +257 -266
  758. package/src/objects/Sprite.js +181 -181
  759. package/src/renderers/WebGL1Renderer.js +7 -7
  760. package/src/renderers/WebGL3DRenderTarget.js +22 -22
  761. package/src/renderers/WebGLArrayRenderTarget.js +22 -22
  762. package/src/renderers/WebGLCubeRenderTarget.js +155 -155
  763. package/src/renderers/WebGLMultipleRenderTargets.js +82 -84
  764. package/src/renderers/WebGLRenderTarget.js +15 -122
  765. package/src/renderers/WebGLRenderer.js +2631 -2439
  766. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -7
  767. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -68
  768. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -7
  769. package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -7
  770. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -7
  771. package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -5
  772. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -18
  773. package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -8
  774. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
  775. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
  776. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -9
  777. package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -9
  778. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -33
  779. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -42
  780. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -7
  781. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -10
  782. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -21
  783. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -33
  784. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -9
  785. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -7
  786. package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -7
  787. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +11 -11
  788. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +11 -11
  789. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +11 -11
  790. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +23 -23
  791. package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -3
  792. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +44 -11
  793. package/src/renderers/shaders/ShaderChunk/common.glsl.js +147 -156
  794. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -191
  795. package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -5
  796. package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -5
  797. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -36
  798. package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -9
  799. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -7
  800. package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -7
  801. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -20
  802. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +9 -9
  803. package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -7
  804. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -14
  805. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +62 -62
  806. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -21
  807. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -22
  808. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -69
  809. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -37
  810. package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -17
  811. package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -19
  812. package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -7
  813. package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -7
  814. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -27
  815. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -121
  816. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -14
  817. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +10 -10
  818. package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -8
  819. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +202 -198
  820. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +13 -13
  821. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +40 -40
  822. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -5
  823. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -28
  824. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +228 -223
  825. package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -7
  826. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -32
  827. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +151 -146
  828. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +562 -560
  829. package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -4
  830. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -26
  831. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -9
  832. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -9
  833. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +16 -16
  834. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +22 -22
  835. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +21 -13
  836. package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +11 -11
  837. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -27
  838. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -27
  839. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -12
  840. package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -7
  841. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -24
  842. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +27 -27
  843. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +38 -38
  844. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +36 -36
  845. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -76
  846. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +33 -33
  847. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -14
  848. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -14
  849. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -14
  850. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -43
  851. package/src/renderers/shaders/ShaderChunk/occlusion_fragment.glsl.js +20 -0
  852. package/src/renderers/shaders/ShaderChunk/occlusion_pars_fragment.glsl.js +97 -0
  853. package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -11
  854. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +68 -68
  855. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +8 -8
  856. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -13
  857. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -12
  858. package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -7
  859. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +314 -314
  860. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +68 -68
  861. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +68 -68
  862. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -66
  863. package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -10
  864. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -33
  865. package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -15
  866. package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -20
  867. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -14
  868. package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -7
  869. package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -7
  870. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +169 -77
  871. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -36
  872. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +201 -201
  873. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -119
  874. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -145
  875. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -122
  876. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -15
  877. package/src/renderers/shaders/ShaderChunk.js +274 -266
  878. package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -32
  879. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -62
  880. package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -36
  881. package/src/renderers/shaders/ShaderLib/depth.glsl.js +95 -94
  882. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +76 -75
  883. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -35
  884. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +77 -75
  885. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +117 -114
  886. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -122
  887. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +113 -109
  888. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +89 -82
  889. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -124
  890. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +226 -222
  891. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +120 -116
  892. package/src/renderers/shaders/ShaderLib/points.glsl.js +88 -86
  893. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +57 -54
  894. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +81 -81
  895. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +53 -53
  896. package/src/renderers/shaders/ShaderLib.js +367 -359
  897. package/src/renderers/shaders/UniformsLib.js +236 -230
  898. package/src/renderers/shaders/UniformsUtils.js +104 -104
  899. package/src/renderers/webgl/WebGLAnimation.js +53 -53
  900. package/src/renderers/webgl/WebGLAttributes.js +229 -195
  901. package/src/renderers/webgl/WebGLBackground.js +239 -247
  902. package/src/renderers/webgl/WebGLBindingStates.js +631 -631
  903. package/src/renderers/webgl/WebGLBufferRenderer.js +92 -61
  904. package/src/renderers/webgl/WebGLCapabilities.js +120 -120
  905. package/src/renderers/webgl/WebGLClipping.js +171 -171
  906. package/src/renderers/webgl/WebGLCubeMaps.js +99 -99
  907. package/src/renderers/webgl/WebGLCubeUVMaps.js +132 -130
  908. package/src/renderers/webgl/WebGLExtensions.js +97 -96
  909. package/src/renderers/webgl/WebGLGeometries.js +211 -207
  910. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +102 -71
  911. package/src/renderers/webgl/WebGLInfo.js +71 -71
  912. package/src/renderers/webgl/WebGLLights.js +590 -570
  913. package/src/renderers/webgl/WebGLMaterials.js +576 -567
  914. package/src/renderers/webgl/WebGLMorphtargets.js +300 -300
  915. package/src/renderers/webgl/WebGLObjects.js +92 -92
  916. package/src/renderers/webgl/WebGLProgram.js +1112 -1002
  917. package/src/renderers/webgl/WebGLPrograms.js +663 -625
  918. package/src/renderers/webgl/WebGLProperties.js +48 -48
  919. package/src/renderers/webgl/WebGLRenderLists.js +238 -238
  920. package/src/renderers/webgl/WebGLRenderStates.js +107 -107
  921. package/src/renderers/webgl/WebGLShader.js +12 -12
  922. package/src/renderers/webgl/WebGLShaderCache.js +124 -124
  923. package/src/renderers/webgl/WebGLShadowMap.js +424 -389
  924. package/src/renderers/webgl/WebGLState.js +1328 -1307
  925. package/src/renderers/webgl/WebGLTextures.js +2117 -2017
  926. package/src/renderers/webgl/WebGLUniforms.js +1156 -1146
  927. package/src/renderers/webgl/WebGLUniformsGroups.js +392 -413
  928. package/src/renderers/webgl/WebGLUtils.js +283 -278
  929. package/src/renderers/webxr/WebXRController.js +343 -343
  930. package/src/renderers/webxr/WebXRManager.js +840 -770
  931. package/src/scenes/Fog.js +38 -37
  932. package/src/scenes/FogExp2.js +35 -34
  933. package/src/scenes/Scene.js +63 -63
  934. package/src/textures/CanvasTexture.js +17 -17
  935. package/src/textures/CompressedArrayTexture.js +18 -18
  936. package/src/textures/CompressedCubeTexture.js +19 -0
  937. package/src/textures/CompressedTexture.js +28 -28
  938. package/src/textures/CubeTexture.js +33 -33
  939. package/src/textures/Data3DTexture.js +35 -35
  940. package/src/textures/DataArrayTexture.js +27 -27
  941. package/src/textures/DataTexture.js +22 -22
  942. package/src/textures/DepthTexture.js +58 -58
  943. package/src/textures/FramebufferTexture.js +23 -23
  944. package/src/textures/Source.js +127 -127
  945. package/src/textures/Texture.js +338 -338
  946. package/src/textures/VideoTexture.js +55 -55
  947. package/src/utils.js +91 -83
  948. package/build/three.js +0 -51661
  949. package/build/three.min.js +0 -7
  950. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -64
  951. package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +0 -30
  952. package/examples/jsm/objects/GroundProjectedSkybox.js +0 -172
  953. package/examples/jsm/renderers/common/RenderTarget.js +0 -15
  954. package/examples/jsm/renderers/common/nodes/NodeRender.js +0 -302
  955. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
  956. package/src/lights/AmbientLightProbe.js +0 -21
  957. package/src/lights/HemisphereLightProbe.js +0 -30
@@ -1,1176 +1,1176 @@
1
- import {
2
- BufferAttribute,
3
- BufferGeometry,
4
- Color,
5
- DynamicDrawUsage,
6
- Mesh,
7
- Sphere,
8
- Vector3
9
- } from 'three';
10
-
11
- /**
12
- * Port of http://webglsamples.org/blob/blob.html
13
- */
14
-
15
- class MarchingCubes extends Mesh {
16
-
17
- constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) {
18
-
19
- const geometry = new BufferGeometry();
20
-
21
- super( geometry, material );
22
-
23
- this.isMarchingCubes = true;
24
-
25
- const scope = this;
26
-
27
- // temp buffers used in polygonize
28
-
29
- const vlist = new Float32Array( 12 * 3 );
30
- const nlist = new Float32Array( 12 * 3 );
31
- const clist = new Float32Array( 12 * 3 );
32
-
33
- this.enableUvs = enableUvs;
34
- this.enableColors = enableColors;
35
-
36
- // functions have to be object properties
37
- // prototype functions kill performance
38
- // (tested and it was 4x slower !!!)
39
-
40
- this.init = function ( resolution ) {
41
-
42
- this.resolution = resolution;
43
-
44
- // parameters
45
-
46
- this.isolation = 80.0;
47
-
48
- // size of field, 32 is pushing it in Javascript :)
49
-
50
- this.size = resolution;
51
- this.size2 = this.size * this.size;
52
- this.size3 = this.size2 * this.size;
53
- this.halfsize = this.size / 2.0;
54
-
55
- // deltas
56
-
57
- this.delta = 2.0 / this.size;
58
- this.yd = this.size;
59
- this.zd = this.size2;
60
-
61
- this.field = new Float32Array( this.size3 );
62
- this.normal_cache = new Float32Array( this.size3 * 3 );
63
- this.palette = new Float32Array( this.size3 * 3 );
64
-
65
- //
66
-
67
- this.count = 0;
68
-
69
- const maxVertexCount = maxPolyCount * 3;
70
-
71
- this.positionArray = new Float32Array( maxVertexCount * 3 );
72
- const positionAttribute = new BufferAttribute( this.positionArray, 3 );
73
- positionAttribute.setUsage( DynamicDrawUsage );
74
- geometry.setAttribute( 'position', positionAttribute );
75
-
76
- this.normalArray = new Float32Array( maxVertexCount * 3 );
77
- const normalAttribute = new BufferAttribute( this.normalArray, 3 );
78
- normalAttribute.setUsage( DynamicDrawUsage );
79
- geometry.setAttribute( 'normal', normalAttribute );
80
-
81
- if ( this.enableUvs ) {
82
-
83
- this.uvArray = new Float32Array( maxVertexCount * 2 );
84
- const uvAttribute = new BufferAttribute( this.uvArray, 2 );
85
- uvAttribute.setUsage( DynamicDrawUsage );
86
- geometry.setAttribute( 'uv', uvAttribute );
87
-
88
- }
89
-
90
- if ( this.enableColors ) {
91
-
92
- this.colorArray = new Float32Array( maxVertexCount * 3 );
93
- const colorAttribute = new BufferAttribute( this.colorArray, 3 );
94
- colorAttribute.setUsage( DynamicDrawUsage );
95
- geometry.setAttribute( 'color', colorAttribute );
96
-
97
- }
98
-
99
- geometry.boundingSphere = new Sphere( new Vector3(), 1 );
100
-
101
- };
102
-
103
- ///////////////////////
104
- // Polygonization
105
- ///////////////////////
106
-
107
- function lerp( a, b, t ) {
108
-
109
- return a + ( b - a ) * t;
110
-
111
- }
112
-
113
- function VIntX( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
114
-
115
- const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
116
- nc = scope.normal_cache;
117
-
118
- vlist[ offset + 0 ] = x + mu * scope.delta;
119
- vlist[ offset + 1 ] = y;
120
- vlist[ offset + 2 ] = z;
121
-
122
- nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q + 3 ], mu );
123
- nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q + 4 ], mu );
124
- nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q + 5 ], mu );
125
-
126
- clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
127
- clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
128
- clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
129
-
130
- }
131
-
132
- function VIntY( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
133
-
134
- const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
135
- nc = scope.normal_cache;
136
-
137
- vlist[ offset + 0 ] = x;
138
- vlist[ offset + 1 ] = y + mu * scope.delta;
139
- vlist[ offset + 2 ] = z;
140
-
141
- const q2 = q + scope.yd * 3;
142
-
143
- nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu );
144
- nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu );
145
- nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu );
146
-
147
- clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
148
- clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
149
- clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
150
-
151
- }
152
-
153
- function VIntZ( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
154
-
155
- const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
156
- nc = scope.normal_cache;
157
-
158
- vlist[ offset + 0 ] = x;
159
- vlist[ offset + 1 ] = y;
160
- vlist[ offset + 2 ] = z + mu * scope.delta;
161
-
162
- const q2 = q + scope.zd * 3;
163
-
164
- nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu );
165
- nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu );
166
- nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu );
167
-
168
- clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
169
- clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
170
- clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
171
-
172
- }
173
-
174
- function compNorm( q ) {
175
-
176
- const q3 = q * 3;
177
-
178
- if ( scope.normal_cache[ q3 ] === 0.0 ) {
179
-
180
- scope.normal_cache[ q3 + 0 ] = scope.field[ q - 1 ] - scope.field[ q + 1 ];
181
- scope.normal_cache[ q3 + 1 ] =
182
- scope.field[ q - scope.yd ] - scope.field[ q + scope.yd ];
183
- scope.normal_cache[ q3 + 2 ] =
184
- scope.field[ q - scope.zd ] - scope.field[ q + scope.zd ];
185
-
186
- }
187
-
188
- }
189
-
190
- // Returns total number of triangles. Fills triangles.
191
- // (this is where most of time is spent - it's inner work of O(n3) loop )
192
-
193
- function polygonize( fx, fy, fz, q, isol ) {
194
-
195
- // cache indices
196
- const q1 = q + 1,
197
- qy = q + scope.yd,
198
- qz = q + scope.zd,
199
- q1y = q1 + scope.yd,
200
- q1z = q1 + scope.zd,
201
- qyz = q + scope.yd + scope.zd,
202
- q1yz = q1 + scope.yd + scope.zd;
203
-
204
- let cubeindex = 0;
205
- const field0 = scope.field[ q ],
206
- field1 = scope.field[ q1 ],
207
- field2 = scope.field[ qy ],
208
- field3 = scope.field[ q1y ],
209
- field4 = scope.field[ qz ],
210
- field5 = scope.field[ q1z ],
211
- field6 = scope.field[ qyz ],
212
- field7 = scope.field[ q1yz ];
213
-
214
- if ( field0 < isol ) cubeindex |= 1;
215
- if ( field1 < isol ) cubeindex |= 2;
216
- if ( field2 < isol ) cubeindex |= 8;
217
- if ( field3 < isol ) cubeindex |= 4;
218
- if ( field4 < isol ) cubeindex |= 16;
219
- if ( field5 < isol ) cubeindex |= 32;
220
- if ( field6 < isol ) cubeindex |= 128;
221
- if ( field7 < isol ) cubeindex |= 64;
222
-
223
- // if cube is entirely in/out of the surface - bail, nothing to draw
224
-
225
- const bits = edgeTable[ cubeindex ];
226
- if ( bits === 0 ) return 0;
227
-
228
- const d = scope.delta,
229
- fx2 = fx + d,
230
- fy2 = fy + d,
231
- fz2 = fz + d;
232
-
233
- // top of the cube
234
-
235
- if ( bits & 1 ) {
236
-
237
- compNorm( q );
238
- compNorm( q1 );
239
- VIntX( q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1 );
240
-
241
- }
242
-
243
- if ( bits & 2 ) {
244
-
245
- compNorm( q1 );
246
- compNorm( q1y );
247
- VIntY( q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y );
248
-
249
- }
250
-
251
- if ( bits & 4 ) {
252
-
253
- compNorm( qy );
254
- compNorm( q1y );
255
- VIntX( qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y );
256
-
257
- }
258
-
259
- if ( bits & 8 ) {
260
-
261
- compNorm( q );
262
- compNorm( qy );
263
- VIntY( q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy );
264
-
265
- }
266
-
267
- // bottom of the cube
268
-
269
- if ( bits & 16 ) {
270
-
271
- compNorm( qz );
272
- compNorm( q1z );
273
- VIntX( qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z );
274
-
275
- }
276
-
277
- if ( bits & 32 ) {
278
-
279
- compNorm( q1z );
280
- compNorm( q1yz );
281
- VIntY(
282
- q1z * 3,
283
- 15,
284
- isol,
285
- fx2,
286
- fy,
287
- fz2,
288
- field5,
289
- field7,
290
- q1z,
291
- q1yz
292
- );
293
-
294
- }
295
-
296
- if ( bits & 64 ) {
297
-
298
- compNorm( qyz );
299
- compNorm( q1yz );
300
- VIntX(
301
- qyz * 3,
302
- 18,
303
- isol,
304
- fx,
305
- fy2,
306
- fz2,
307
- field6,
308
- field7,
309
- qyz,
310
- q1yz
311
- );
312
-
313
- }
314
-
315
- if ( bits & 128 ) {
316
-
317
- compNorm( qz );
318
- compNorm( qyz );
319
- VIntY( qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz );
320
-
321
- }
322
-
323
- // vertical lines of the cube
324
- if ( bits & 256 ) {
325
-
326
- compNorm( q );
327
- compNorm( qz );
328
- VIntZ( q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz );
329
-
330
- }
331
-
332
- if ( bits & 512 ) {
333
-
334
- compNorm( q1 );
335
- compNorm( q1z );
336
- VIntZ( q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z );
337
-
338
- }
339
-
340
- if ( bits & 1024 ) {
341
-
342
- compNorm( q1y );
343
- compNorm( q1yz );
344
- VIntZ(
345
- q1y * 3,
346
- 30,
347
- isol,
348
- fx2,
349
- fy2,
350
- fz,
351
- field3,
352
- field7,
353
- q1y,
354
- q1yz
355
- );
356
-
357
- }
358
-
359
- if ( bits & 2048 ) {
360
-
361
- compNorm( qy );
362
- compNorm( qyz );
363
- VIntZ( qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz );
364
-
365
- }
366
-
367
- cubeindex <<= 4; // re-purpose cubeindex into an offset into triTable
368
-
369
- let o1,
370
- o2,
371
- o3,
372
- numtris = 0,
373
- i = 0;
374
-
375
- // here is where triangles are created
376
-
377
- while ( triTable[ cubeindex + i ] != - 1 ) {
378
-
379
- o1 = cubeindex + i;
380
- o2 = o1 + 1;
381
- o3 = o1 + 2;
382
-
383
- posnormtriv(
384
- vlist,
385
- nlist,
386
- clist,
387
- 3 * triTable[ o1 ],
388
- 3 * triTable[ o2 ],
389
- 3 * triTable[ o3 ]
390
- );
391
-
392
- i += 3;
393
- numtris ++;
394
-
395
- }
396
-
397
- return numtris;
398
-
399
- }
400
-
401
- function posnormtriv( pos, norm, colors, o1, o2, o3 ) {
402
-
403
- const c = scope.count * 3;
404
-
405
- // positions
406
-
407
- scope.positionArray[ c + 0 ] = pos[ o1 ];
408
- scope.positionArray[ c + 1 ] = pos[ o1 + 1 ];
409
- scope.positionArray[ c + 2 ] = pos[ o1 + 2 ];
410
-
411
- scope.positionArray[ c + 3 ] = pos[ o2 ];
412
- scope.positionArray[ c + 4 ] = pos[ o2 + 1 ];
413
- scope.positionArray[ c + 5 ] = pos[ o2 + 2 ];
414
-
415
- scope.positionArray[ c + 6 ] = pos[ o3 ];
416
- scope.positionArray[ c + 7 ] = pos[ o3 + 1 ];
417
- scope.positionArray[ c + 8 ] = pos[ o3 + 2 ];
418
-
419
- // normals
420
-
421
- if ( scope.material.flatShading === true ) {
422
-
423
- const nx = ( norm[ o1 + 0 ] + norm[ o2 + 0 ] + norm[ o3 + 0 ] ) / 3;
424
- const ny = ( norm[ o1 + 1 ] + norm[ o2 + 1 ] + norm[ o3 + 1 ] ) / 3;
425
- const nz = ( norm[ o1 + 2 ] + norm[ o2 + 2 ] + norm[ o3 + 2 ] ) / 3;
426
-
427
- scope.normalArray[ c + 0 ] = nx;
428
- scope.normalArray[ c + 1 ] = ny;
429
- scope.normalArray[ c + 2 ] = nz;
430
-
431
- scope.normalArray[ c + 3 ] = nx;
432
- scope.normalArray[ c + 4 ] = ny;
433
- scope.normalArray[ c + 5 ] = nz;
434
-
435
- scope.normalArray[ c + 6 ] = nx;
436
- scope.normalArray[ c + 7 ] = ny;
437
- scope.normalArray[ c + 8 ] = nz;
438
-
439
- } else {
440
-
441
- scope.normalArray[ c + 0 ] = norm[ o1 + 0 ];
442
- scope.normalArray[ c + 1 ] = norm[ o1 + 1 ];
443
- scope.normalArray[ c + 2 ] = norm[ o1 + 2 ];
444
-
445
- scope.normalArray[ c + 3 ] = norm[ o2 + 0 ];
446
- scope.normalArray[ c + 4 ] = norm[ o2 + 1 ];
447
- scope.normalArray[ c + 5 ] = norm[ o2 + 2 ];
448
-
449
- scope.normalArray[ c + 6 ] = norm[ o3 + 0 ];
450
- scope.normalArray[ c + 7 ] = norm[ o3 + 1 ];
451
- scope.normalArray[ c + 8 ] = norm[ o3 + 2 ];
452
-
453
- }
454
-
455
- // uvs
456
-
457
- if ( scope.enableUvs ) {
458
-
459
- const d = scope.count * 2;
460
-
461
- scope.uvArray[ d + 0 ] = pos[ o1 + 0 ];
462
- scope.uvArray[ d + 1 ] = pos[ o1 + 2 ];
463
-
464
- scope.uvArray[ d + 2 ] = pos[ o2 + 0 ];
465
- scope.uvArray[ d + 3 ] = pos[ o2 + 2 ];
466
-
467
- scope.uvArray[ d + 4 ] = pos[ o3 + 0 ];
468
- scope.uvArray[ d + 5 ] = pos[ o3 + 2 ];
469
-
470
- }
471
-
472
- // colors
473
-
474
- if ( scope.enableColors ) {
475
-
476
- scope.colorArray[ c + 0 ] = colors[ o1 + 0 ];
477
- scope.colorArray[ c + 1 ] = colors[ o1 + 1 ];
478
- scope.colorArray[ c + 2 ] = colors[ o1 + 2 ];
479
-
480
- scope.colorArray[ c + 3 ] = colors[ o2 + 0 ];
481
- scope.colorArray[ c + 4 ] = colors[ o2 + 1 ];
482
- scope.colorArray[ c + 5 ] = colors[ o2 + 2 ];
483
-
484
- scope.colorArray[ c + 6 ] = colors[ o3 + 0 ];
485
- scope.colorArray[ c + 7 ] = colors[ o3 + 1 ];
486
- scope.colorArray[ c + 8 ] = colors[ o3 + 2 ];
487
-
488
- }
489
-
490
- scope.count += 3;
491
-
492
- }
493
-
494
- /////////////////////////////////////
495
- // Metaballs
496
- /////////////////////////////////////
497
-
498
- // Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after
499
- // a fixed distance, determined by strength and subtract.
500
-
501
- this.addBall = function ( ballx, bally, ballz, strength, subtract, colors ) {
502
-
503
- const sign = Math.sign( strength );
504
- strength = Math.abs( strength );
505
- const userDefineColor = ! ( colors === undefined || colors === null );
506
- let ballColor = new Color( ballx, bally, ballz );
507
-
508
- if ( userDefineColor ) {
509
-
510
- try {
511
-
512
- ballColor =
513
- colors instanceof Color
514
- ? colors
515
- : Array.isArray( colors )
516
- ? new Color(
517
- Math.min( Math.abs( colors[ 0 ] ), 1 ),
518
- Math.min( Math.abs( colors[ 1 ] ), 1 ),
519
- Math.min( Math.abs( colors[ 2 ] ), 1 )
520
- )
521
- : new Color( colors );
522
-
523
- } catch ( err ) {
524
-
525
- ballColor = new Color( ballx, bally, ballz );
526
-
527
- }
528
-
529
- }
530
-
531
- // Let's solve the equation to find the radius:
532
- // 1.0 / (0.000001 + radius^2) * strength - subtract = 0
533
- // strength / (radius^2) = subtract
534
- // strength = subtract * radius^2
535
- // radius^2 = strength / subtract
536
- // radius = sqrt(strength / subtract)
537
-
538
- const radius = this.size * Math.sqrt( strength / subtract ),
539
- zs = ballz * this.size,
540
- ys = bally * this.size,
541
- xs = ballx * this.size;
542
-
543
- let min_z = Math.floor( zs - radius );
544
- if ( min_z < 1 ) min_z = 1;
545
- let max_z = Math.floor( zs + radius );
546
- if ( max_z > this.size - 1 ) max_z = this.size - 1;
547
- let min_y = Math.floor( ys - radius );
548
- if ( min_y < 1 ) min_y = 1;
549
- let max_y = Math.floor( ys + radius );
550
- if ( max_y > this.size - 1 ) max_y = this.size - 1;
551
- let min_x = Math.floor( xs - radius );
552
- if ( min_x < 1 ) min_x = 1;
553
- let max_x = Math.floor( xs + radius );
554
- if ( max_x > this.size - 1 ) max_x = this.size - 1;
555
-
556
- // Don't polygonize in the outer layer because normals aren't
557
- // well-defined there.
558
-
559
- let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val;
560
-
561
- for ( z = min_z; z < max_z; z ++ ) {
562
-
563
- z_offset = this.size2 * z;
564
- fz = z / this.size - ballz;
565
- fz2 = fz * fz;
566
-
567
- for ( y = min_y; y < max_y; y ++ ) {
568
-
569
- y_offset = z_offset + this.size * y;
570
- fy = y / this.size - bally;
571
- fy2 = fy * fy;
572
-
573
- for ( x = min_x; x < max_x; x ++ ) {
574
-
575
- fx = x / this.size - ballx;
576
- val = strength / ( 0.000001 + fx * fx + fy2 + fz2 ) - subtract;
577
- if ( val > 0.0 ) {
578
-
579
- this.field[ y_offset + x ] += val * sign;
580
-
581
- // optimization
582
- // http://www.geisswerks.com/ryan/BLOBS/blobs.html
583
- const ratio =
584
- Math.sqrt( ( x - xs ) * ( x - xs ) + ( y - ys ) * ( y - ys ) + ( z - zs ) * ( z - zs ) ) / radius;
585
- const contrib =
586
- 1 - ratio * ratio * ratio * ( ratio * ( ratio * 6 - 15 ) + 10 );
587
- this.palette[ ( y_offset + x ) * 3 + 0 ] += ballColor.r * contrib;
588
- this.palette[ ( y_offset + x ) * 3 + 1 ] += ballColor.g * contrib;
589
- this.palette[ ( y_offset + x ) * 3 + 2 ] += ballColor.b * contrib;
590
-
591
- }
592
-
593
- }
594
-
595
- }
596
-
597
- }
598
-
599
- };
600
-
601
- this.addPlaneX = function ( strength, subtract ) {
602
-
603
- // cache attribute lookups
604
- const size = this.size,
605
- yd = this.yd,
606
- zd = this.zd,
607
- field = this.field;
608
-
609
- let x,
610
- y,
611
- z,
612
- xx,
613
- val,
614
- xdiv,
615
- cxy,
616
- dist = size * Math.sqrt( strength / subtract );
617
-
618
- if ( dist > size ) dist = size;
619
-
620
- for ( x = 0; x < dist; x ++ ) {
621
-
622
- xdiv = x / size;
623
- xx = xdiv * xdiv;
624
- val = strength / ( 0.0001 + xx ) - subtract;
625
-
626
- if ( val > 0.0 ) {
627
-
628
- for ( y = 0; y < size; y ++ ) {
629
-
630
- cxy = x + y * yd;
631
-
632
- for ( z = 0; z < size; z ++ ) {
633
-
634
- field[ zd * z + cxy ] += val;
635
-
636
- }
637
-
638
- }
639
-
640
- }
641
-
642
- }
643
-
644
- };
645
-
646
- this.addPlaneY = function ( strength, subtract ) {
647
-
648
- // cache attribute lookups
649
- const size = this.size,
650
- yd = this.yd,
651
- zd = this.zd,
652
- field = this.field;
653
-
654
- let x,
655
- y,
656
- z,
657
- yy,
658
- val,
659
- ydiv,
660
- cy,
661
- cxy,
662
- dist = size * Math.sqrt( strength / subtract );
663
-
664
- if ( dist > size ) dist = size;
665
-
666
- for ( y = 0; y < dist; y ++ ) {
667
-
668
- ydiv = y / size;
669
- yy = ydiv * ydiv;
670
- val = strength / ( 0.0001 + yy ) - subtract;
671
-
672
- if ( val > 0.0 ) {
673
-
674
- cy = y * yd;
675
-
676
- for ( x = 0; x < size; x ++ ) {
677
-
678
- cxy = cy + x;
679
-
680
- for ( z = 0; z < size; z ++ ) field[ zd * z + cxy ] += val;
681
-
682
- }
683
-
684
- }
685
-
686
- }
687
-
688
- };
689
-
690
- this.addPlaneZ = function ( strength, subtract ) {
691
-
692
- // cache attribute lookups
693
-
694
- const size = this.size,
695
- yd = this.yd,
696
- zd = this.zd,
697
- field = this.field;
698
-
699
- let x,
700
- y,
701
- z,
702
- zz,
703
- val,
704
- zdiv,
705
- cz,
706
- cyz,
707
- dist = size * Math.sqrt( strength / subtract );
708
-
709
- if ( dist > size ) dist = size;
710
-
711
- for ( z = 0; z < dist; z ++ ) {
712
-
713
- zdiv = z / size;
714
- zz = zdiv * zdiv;
715
- val = strength / ( 0.0001 + zz ) - subtract;
716
- if ( val > 0.0 ) {
717
-
718
- cz = zd * z;
719
-
720
- for ( y = 0; y < size; y ++ ) {
721
-
722
- cyz = cz + y * yd;
723
-
724
- for ( x = 0; x < size; x ++ ) field[ cyz + x ] += val;
725
-
726
- }
727
-
728
- }
729
-
730
- }
731
-
732
- };
733
-
734
- /////////////////////////////////////
735
- // Updates
736
- /////////////////////////////////////
737
-
738
- this.setCell = function ( x, y, z, value ) {
739
-
740
- const index = this.size2 * z + this.size * y + x;
741
- this.field[ index ] = value;
742
-
743
- };
744
-
745
- this.getCell = function ( x, y, z ) {
746
-
747
- const index = this.size2 * z + this.size * y + x;
748
- return this.field[ index ];
749
-
750
- };
751
-
752
- this.blur = function ( intensity = 1 ) {
753
-
754
- const field = this.field;
755
- const fieldCopy = field.slice();
756
- const size = this.size;
757
- const size2 = this.size2;
758
- for ( let x = 0; x < size; x ++ ) {
759
-
760
- for ( let y = 0; y < size; y ++ ) {
761
-
762
- for ( let z = 0; z < size; z ++ ) {
763
-
764
- const index = size2 * z + size * y + x;
765
- let val = fieldCopy[ index ];
766
- let count = 1;
767
-
768
- for ( let x2 = - 1; x2 <= 1; x2 += 2 ) {
769
-
770
- const x3 = x2 + x;
771
- if ( x3 < 0 || x3 >= size ) continue;
772
-
773
- for ( let y2 = - 1; y2 <= 1; y2 += 2 ) {
774
-
775
- const y3 = y2 + y;
776
- if ( y3 < 0 || y3 >= size ) continue;
777
-
778
- for ( let z2 = - 1; z2 <= 1; z2 += 2 ) {
779
-
780
- const z3 = z2 + z;
781
- if ( z3 < 0 || z3 >= size ) continue;
782
-
783
- const index2 = size2 * z3 + size * y3 + x3;
784
- const val2 = fieldCopy[ index2 ];
785
-
786
- count ++;
787
- val += intensity * ( val2 - val ) / count;
788
-
789
- }
790
-
791
- }
792
-
793
- }
794
-
795
- field[ index ] = val;
796
-
797
- }
798
-
799
- }
800
-
801
- }
802
-
803
- };
804
-
805
- this.reset = function () {
806
-
807
- // wipe the normal cache
808
-
809
- for ( let i = 0; i < this.size3; i ++ ) {
810
-
811
- this.normal_cache[ i * 3 ] = 0.0;
812
- this.field[ i ] = 0.0;
813
- this.palette[ i * 3 ] = this.palette[ i * 3 + 1 ] = this.palette[
814
- i * 3 + 2
815
- ] = 0.0;
816
-
817
- }
818
-
819
- };
820
-
821
- this.update = function () {
822
-
823
- this.count = 0;
824
-
825
- // Triangulate. Yeah, this is slow.
826
-
827
- const smin2 = this.size - 2;
828
-
829
- for ( let z = 1; z < smin2; z ++ ) {
830
-
831
- const z_offset = this.size2 * z;
832
- const fz = ( z - this.halfsize ) / this.halfsize; //+ 1
833
-
834
- for ( let y = 1; y < smin2; y ++ ) {
835
-
836
- const y_offset = z_offset + this.size * y;
837
- const fy = ( y - this.halfsize ) / this.halfsize; //+ 1
838
-
839
- for ( let x = 1; x < smin2; x ++ ) {
840
-
841
- const fx = ( x - this.halfsize ) / this.halfsize; //+ 1
842
- const q = y_offset + x;
843
-
844
- polygonize( fx, fy, fz, q, this.isolation );
845
-
846
- }
847
-
848
- }
849
-
850
- }
851
-
852
- // set the draw range to only the processed triangles
853
-
854
- this.geometry.setDrawRange( 0, this.count );
855
-
856
- // update geometry data
857
-
858
- geometry.getAttribute( 'position' ).needsUpdate = true;
859
- geometry.getAttribute( 'normal' ).needsUpdate = true;
860
-
861
- if ( this.enableUvs ) geometry.getAttribute( 'uv' ).needsUpdate = true;
862
- if ( this.enableColors ) geometry.getAttribute( 'color' ).needsUpdate = true;
863
-
864
- // safety check
865
-
866
- if ( this.count / 3 > maxPolyCount ) console.warn( 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.' );
867
-
868
- };
869
-
870
- this.init( resolution );
871
-
872
- }
873
-
874
- }
875
-
876
- /////////////////////////////////////
877
- // Marching cubes lookup tables
878
- /////////////////////////////////////
879
-
880
- // These tables are straight from Paul Bourke's page:
881
- // http://paulbourke.net/geometry/polygonise/
882
- // who in turn got them from Cory Gene Bloyd.
883
-
884
- const edgeTable = new Int32Array( [
885
- 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
886
- 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
887
- 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
888
- 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
889
- 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,
890
- 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
891
- 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,
892
- 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
893
- 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,
894
- 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
895
- 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,
896
- 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
897
- 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,
898
- 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
899
- 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,
900
- 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
901
- 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
902
- 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
903
- 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
904
- 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
905
- 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
906
- 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
907
- 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
908
- 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,
909
- 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
910
- 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,
911
- 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
912
- 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,
913
- 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
914
- 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,
915
- 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
916
- 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] );
917
-
918
- const triTable = new Int32Array( [
919
- - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
920
- 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
921
- 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
922
- 1, 8, 3, 9, 8, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
923
- 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
924
- 0, 8, 3, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
925
- 9, 2, 10, 0, 2, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
926
- 2, 8, 3, 2, 10, 8, 10, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
927
- 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
928
- 0, 11, 2, 8, 11, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
929
- 1, 9, 0, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
930
- 1, 11, 2, 1, 9, 11, 9, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
931
- 3, 10, 1, 11, 10, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
932
- 0, 10, 1, 0, 8, 10, 8, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
933
- 3, 9, 0, 3, 11, 9, 11, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
934
- 9, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
935
- 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
936
- 4, 3, 0, 7, 3, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
937
- 0, 1, 9, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
938
- 4, 1, 9, 4, 7, 1, 7, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
939
- 1, 2, 10, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
940
- 3, 4, 7, 3, 0, 4, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
941
- 9, 2, 10, 9, 0, 2, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
942
- 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,
943
- 8, 4, 7, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
944
- 11, 4, 7, 11, 2, 4, 2, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
945
- 9, 0, 1, 8, 4, 7, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
946
- 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, - 1, - 1, - 1, - 1,
947
- 3, 10, 1, 3, 11, 10, 7, 8, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
948
- 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, - 1, - 1, - 1, - 1,
949
- 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,
950
- 4, 7, 11, 4, 11, 9, 9, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
951
- 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
952
- 9, 5, 4, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
953
- 0, 5, 4, 1, 5, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
954
- 8, 5, 4, 8, 3, 5, 3, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
955
- 1, 2, 10, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
956
- 3, 0, 8, 1, 2, 10, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
957
- 5, 2, 10, 5, 4, 2, 4, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
958
- 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, - 1, - 1, - 1, - 1,
959
- 9, 5, 4, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
960
- 0, 11, 2, 0, 8, 11, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
961
- 0, 5, 4, 0, 1, 5, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
962
- 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, - 1, - 1, - 1, - 1,
963
- 10, 3, 11, 10, 1, 3, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
964
- 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, - 1, - 1, - 1, - 1,
965
- 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,
966
- 5, 4, 8, 5, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
967
- 9, 7, 8, 5, 7, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
968
- 9, 3, 0, 9, 5, 3, 5, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
969
- 0, 7, 8, 0, 1, 7, 1, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
970
- 1, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
971
- 9, 7, 8, 9, 5, 7, 10, 1, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
972
- 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, - 1, - 1, - 1, - 1,
973
- 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, - 1, - 1, - 1, - 1,
974
- 2, 10, 5, 2, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
975
- 7, 9, 5, 7, 8, 9, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
976
- 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,
977
- 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, - 1, - 1, - 1, - 1,
978
- 11, 2, 1, 11, 1, 7, 7, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
979
- 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, - 1, - 1, - 1, - 1,
980
- 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, - 1,
981
- 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, - 1,
982
- 11, 10, 5, 7, 11, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
983
- 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
984
- 0, 8, 3, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
985
- 9, 0, 1, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
986
- 1, 8, 3, 1, 9, 8, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
987
- 1, 6, 5, 2, 6, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
988
- 1, 6, 5, 1, 2, 6, 3, 0, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
989
- 9, 6, 5, 9, 0, 6, 0, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
990
- 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, - 1, - 1, - 1, - 1,
991
- 2, 3, 11, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
992
- 11, 0, 8, 11, 2, 0, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
993
- 0, 1, 9, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
994
- 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, - 1, - 1, - 1, - 1,
995
- 6, 3, 11, 6, 5, 3, 5, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
996
- 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,
997
- 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, - 1, - 1, - 1, - 1,
998
- 6, 5, 9, 6, 9, 11, 11, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
999
- 5, 10, 6, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1000
- 4, 3, 0, 4, 7, 3, 6, 5, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1001
- 1, 9, 0, 5, 10, 6, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1002
- 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,
1003
- 6, 1, 2, 6, 5, 1, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1004
- 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, - 1, - 1, - 1, - 1,
1005
- 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, - 1, - 1, - 1, - 1,
1006
- 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, - 1,
1007
- 3, 11, 2, 7, 8, 4, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1008
- 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,
1009
- 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1,
1010
- 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, - 1,
1011
- 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,
1012
- 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, - 1,
1013
- 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, - 1,
1014
- 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, - 1, - 1, - 1, - 1,
1015
- 10, 4, 9, 6, 4, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1016
- 4, 10, 6, 4, 9, 10, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1017
- 10, 0, 1, 10, 6, 0, 6, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1018
- 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,
1019
- 1, 4, 9, 1, 2, 4, 2, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1020
- 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, - 1, - 1, - 1, - 1,
1021
- 0, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1022
- 8, 3, 2, 8, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1023
- 10, 4, 9, 10, 6, 4, 11, 2, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1024
- 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, - 1, - 1, - 1, - 1,
1025
- 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,
1026
- 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, - 1,
1027
- 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, - 1, - 1, - 1, - 1,
1028
- 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, - 1,
1029
- 3, 11, 6, 3, 6, 0, 0, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1030
- 6, 4, 8, 11, 6, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1031
- 7, 10, 6, 7, 8, 10, 8, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1032
- 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, - 1, - 1, - 1, - 1,
1033
- 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, - 1, - 1, - 1, - 1,
1034
- 10, 6, 7, 10, 7, 1, 1, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1035
- 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,
1036
- 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, - 1,
1037
- 7, 8, 0, 7, 0, 6, 6, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1038
- 7, 3, 2, 6, 7, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1039
- 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,
1040
- 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, - 1,
1041
- 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, - 1,
1042
- 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, - 1, - 1, - 1, - 1,
1043
- 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, - 1,
1044
- 0, 9, 1, 11, 6, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1045
- 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, - 1, - 1, - 1, - 1,
1046
- 7, 11, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1047
- 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1048
- 3, 0, 8, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1049
- 0, 1, 9, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1050
- 8, 1, 9, 8, 3, 1, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1051
- 10, 1, 2, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1052
- 1, 2, 10, 3, 0, 8, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1053
- 2, 9, 0, 2, 10, 9, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1054
- 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, - 1, - 1, - 1, - 1,
1055
- 7, 2, 3, 6, 2, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1056
- 7, 0, 8, 7, 6, 0, 6, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1057
- 2, 7, 6, 2, 3, 7, 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1058
- 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, - 1, - 1, - 1, - 1,
1059
- 10, 7, 6, 10, 1, 7, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1060
- 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, - 1, - 1, - 1, - 1,
1061
- 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, - 1, - 1, - 1, - 1,
1062
- 7, 6, 10, 7, 10, 8, 8, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1063
- 6, 8, 4, 11, 8, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1064
- 3, 6, 11, 3, 0, 6, 0, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1065
- 8, 6, 11, 8, 4, 6, 9, 0, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1066
- 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, - 1, - 1, - 1, - 1,
1067
- 6, 8, 4, 6, 11, 8, 2, 10, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1068
- 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, - 1, - 1, - 1, - 1,
1069
- 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, - 1, - 1, - 1, - 1,
1070
- 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, - 1,
1071
- 8, 2, 3, 8, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1072
- 0, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1073
- 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, - 1, - 1, - 1, - 1,
1074
- 1, 9, 4, 1, 4, 2, 2, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1075
- 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, - 1, - 1, - 1, - 1,
1076
- 10, 1, 0, 10, 0, 6, 6, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1077
- 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, - 1,
1078
- 10, 9, 4, 6, 10, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1079
- 4, 9, 5, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1080
- 0, 8, 3, 4, 9, 5, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1081
- 5, 0, 1, 5, 4, 0, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1082
- 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, - 1, - 1, - 1, - 1,
1083
- 9, 5, 4, 10, 1, 2, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1084
- 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, - 1, - 1, - 1, - 1,
1085
- 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, - 1, - 1, - 1, - 1,
1086
- 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, - 1,
1087
- 7, 2, 3, 7, 6, 2, 5, 4, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1088
- 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, - 1, - 1, - 1, - 1,
1089
- 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, - 1, - 1, - 1, - 1,
1090
- 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, - 1,
1091
- 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, - 1, - 1, - 1, - 1,
1092
- 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, - 1,
1093
- 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, - 1,
1094
- 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, - 1, - 1, - 1, - 1,
1095
- 6, 9, 5, 6, 11, 9, 11, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1096
- 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, - 1, - 1, - 1, - 1,
1097
- 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, - 1, - 1, - 1, - 1,
1098
- 6, 11, 3, 6, 3, 5, 5, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1099
- 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, - 1, - 1, - 1, - 1,
1100
- 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, - 1,
1101
- 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, - 1,
1102
- 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, - 1, - 1, - 1, - 1,
1103
- 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, - 1, - 1, - 1, - 1,
1104
- 9, 5, 6, 9, 6, 0, 0, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1105
- 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, - 1,
1106
- 1, 5, 6, 2, 1, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1107
- 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, - 1,
1108
- 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, - 1, - 1, - 1, - 1,
1109
- 0, 3, 8, 5, 6, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1110
- 10, 5, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1111
- 11, 5, 10, 7, 5, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1112
- 11, 5, 10, 11, 7, 5, 8, 3, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1113
- 5, 11, 7, 5, 10, 11, 1, 9, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1114
- 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, - 1, - 1, - 1, - 1,
1115
- 11, 1, 2, 11, 7, 1, 7, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1116
- 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, - 1, - 1, - 1, - 1,
1117
- 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, - 1, - 1, - 1, - 1,
1118
- 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, - 1,
1119
- 2, 5, 10, 2, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1120
- 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, - 1, - 1, - 1, - 1,
1121
- 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, - 1, - 1, - 1, - 1,
1122
- 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, - 1,
1123
- 1, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1124
- 0, 8, 7, 0, 7, 1, 1, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1125
- 9, 0, 3, 9, 3, 5, 5, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1126
- 9, 8, 7, 5, 9, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1127
- 5, 8, 4, 5, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1128
- 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, - 1, - 1, - 1, - 1,
1129
- 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, - 1, - 1, - 1, - 1,
1130
- 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, - 1,
1131
- 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, - 1, - 1, - 1, - 1,
1132
- 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, - 1,
1133
- 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, - 1,
1134
- 9, 4, 5, 2, 11, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1135
- 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, - 1, - 1, - 1, - 1,
1136
- 5, 10, 2, 5, 2, 4, 4, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1137
- 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, - 1,
1138
- 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, - 1, - 1, - 1, - 1,
1139
- 8, 4, 5, 8, 5, 3, 3, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1140
- 0, 4, 5, 1, 0, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1141
- 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, - 1, - 1, - 1, - 1,
1142
- 9, 4, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1143
- 4, 11, 7, 4, 9, 11, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1144
- 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, - 1, - 1, - 1, - 1,
1145
- 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, - 1, - 1, - 1, - 1,
1146
- 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, - 1,
1147
- 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, - 1, - 1, - 1, - 1,
1148
- 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, - 1,
1149
- 11, 7, 4, 11, 4, 2, 2, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1150
- 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, - 1, - 1, - 1, - 1,
1151
- 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, - 1, - 1, - 1, - 1,
1152
- 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, - 1,
1153
- 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, - 1,
1154
- 1, 10, 2, 8, 7, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1155
- 4, 9, 1, 4, 1, 7, 7, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1156
- 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, - 1, - 1, - 1, - 1,
1157
- 4, 0, 3, 7, 4, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1158
- 4, 8, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1159
- 9, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1160
- 3, 0, 9, 3, 9, 11, 11, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1161
- 0, 1, 10, 0, 10, 8, 8, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1162
- 3, 1, 10, 11, 3, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1163
- 1, 2, 11, 1, 11, 9, 9, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1164
- 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, - 1, - 1, - 1, - 1,
1165
- 0, 2, 11, 8, 0, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1166
- 3, 2, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1167
- 2, 3, 8, 2, 8, 10, 10, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1168
- 9, 10, 2, 0, 9, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1169
- 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, - 1, - 1, - 1, - 1,
1170
- 1, 10, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1171
- 1, 3, 8, 9, 1, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1172
- 0, 9, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1173
- 0, 3, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1174
- - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 ] );
1175
-
1176
- export { MarchingCubes, edgeTable, triTable };
1
+ import {
2
+ BufferAttribute,
3
+ BufferGeometry,
4
+ Color,
5
+ DynamicDrawUsage,
6
+ Mesh,
7
+ Sphere,
8
+ Vector3
9
+ } from 'three';
10
+
11
+ /**
12
+ * Port of http://webglsamples.org/blob/blob.html
13
+ */
14
+
15
+ class MarchingCubes extends Mesh {
16
+
17
+ constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) {
18
+
19
+ const geometry = new BufferGeometry();
20
+
21
+ super( geometry, material );
22
+
23
+ this.isMarchingCubes = true;
24
+
25
+ const scope = this;
26
+
27
+ // temp buffers used in polygonize
28
+
29
+ const vlist = new Float32Array( 12 * 3 );
30
+ const nlist = new Float32Array( 12 * 3 );
31
+ const clist = new Float32Array( 12 * 3 );
32
+
33
+ this.enableUvs = enableUvs;
34
+ this.enableColors = enableColors;
35
+
36
+ // functions have to be object properties
37
+ // prototype functions kill performance
38
+ // (tested and it was 4x slower !!!)
39
+
40
+ this.init = function ( resolution ) {
41
+
42
+ this.resolution = resolution;
43
+
44
+ // parameters
45
+
46
+ this.isolation = 80.0;
47
+
48
+ // size of field, 32 is pushing it in Javascript :)
49
+
50
+ this.size = resolution;
51
+ this.size2 = this.size * this.size;
52
+ this.size3 = this.size2 * this.size;
53
+ this.halfsize = this.size / 2.0;
54
+
55
+ // deltas
56
+
57
+ this.delta = 2.0 / this.size;
58
+ this.yd = this.size;
59
+ this.zd = this.size2;
60
+
61
+ this.field = new Float32Array( this.size3 );
62
+ this.normal_cache = new Float32Array( this.size3 * 3 );
63
+ this.palette = new Float32Array( this.size3 * 3 );
64
+
65
+ //
66
+
67
+ this.count = 0;
68
+
69
+ const maxVertexCount = maxPolyCount * 3;
70
+
71
+ this.positionArray = new Float32Array( maxVertexCount * 3 );
72
+ const positionAttribute = new BufferAttribute( this.positionArray, 3 );
73
+ positionAttribute.setUsage( DynamicDrawUsage );
74
+ geometry.setAttribute( 'position', positionAttribute );
75
+
76
+ this.normalArray = new Float32Array( maxVertexCount * 3 );
77
+ const normalAttribute = new BufferAttribute( this.normalArray, 3 );
78
+ normalAttribute.setUsage( DynamicDrawUsage );
79
+ geometry.setAttribute( 'normal', normalAttribute );
80
+
81
+ if ( this.enableUvs ) {
82
+
83
+ this.uvArray = new Float32Array( maxVertexCount * 2 );
84
+ const uvAttribute = new BufferAttribute( this.uvArray, 2 );
85
+ uvAttribute.setUsage( DynamicDrawUsage );
86
+ geometry.setAttribute( 'uv', uvAttribute );
87
+
88
+ }
89
+
90
+ if ( this.enableColors ) {
91
+
92
+ this.colorArray = new Float32Array( maxVertexCount * 3 );
93
+ const colorAttribute = new BufferAttribute( this.colorArray, 3 );
94
+ colorAttribute.setUsage( DynamicDrawUsage );
95
+ geometry.setAttribute( 'color', colorAttribute );
96
+
97
+ }
98
+
99
+ geometry.boundingSphere = new Sphere( new Vector3(), 1 );
100
+
101
+ };
102
+
103
+ ///////////////////////
104
+ // Polygonization
105
+ ///////////////////////
106
+
107
+ function lerp( a, b, t ) {
108
+
109
+ return a + ( b - a ) * t;
110
+
111
+ }
112
+
113
+ function VIntX( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
114
+
115
+ const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
116
+ nc = scope.normal_cache;
117
+
118
+ vlist[ offset + 0 ] = x + mu * scope.delta;
119
+ vlist[ offset + 1 ] = y;
120
+ vlist[ offset + 2 ] = z;
121
+
122
+ nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q + 3 ], mu );
123
+ nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q + 4 ], mu );
124
+ nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q + 5 ], mu );
125
+
126
+ clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
127
+ clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
128
+ clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
129
+
130
+ }
131
+
132
+ function VIntY( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
133
+
134
+ const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
135
+ nc = scope.normal_cache;
136
+
137
+ vlist[ offset + 0 ] = x;
138
+ vlist[ offset + 1 ] = y + mu * scope.delta;
139
+ vlist[ offset + 2 ] = z;
140
+
141
+ const q2 = q + scope.yd * 3;
142
+
143
+ nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu );
144
+ nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu );
145
+ nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu );
146
+
147
+ clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
148
+ clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
149
+ clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
150
+
151
+ }
152
+
153
+ function VIntZ( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) {
154
+
155
+ const mu = ( isol - valp1 ) / ( valp2 - valp1 ),
156
+ nc = scope.normal_cache;
157
+
158
+ vlist[ offset + 0 ] = x;
159
+ vlist[ offset + 1 ] = y;
160
+ vlist[ offset + 2 ] = z + mu * scope.delta;
161
+
162
+ const q2 = q + scope.zd * 3;
163
+
164
+ nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu );
165
+ nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu );
166
+ nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu );
167
+
168
+ clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu );
169
+ clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu );
170
+ clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu );
171
+
172
+ }
173
+
174
+ function compNorm( q ) {
175
+
176
+ const q3 = q * 3;
177
+
178
+ if ( scope.normal_cache[ q3 ] === 0.0 ) {
179
+
180
+ scope.normal_cache[ q3 + 0 ] = scope.field[ q - 1 ] - scope.field[ q + 1 ];
181
+ scope.normal_cache[ q3 + 1 ] =
182
+ scope.field[ q - scope.yd ] - scope.field[ q + scope.yd ];
183
+ scope.normal_cache[ q3 + 2 ] =
184
+ scope.field[ q - scope.zd ] - scope.field[ q + scope.zd ];
185
+
186
+ }
187
+
188
+ }
189
+
190
+ // Returns total number of triangles. Fills triangles.
191
+ // (this is where most of time is spent - it's inner work of O(n3) loop )
192
+
193
+ function polygonize( fx, fy, fz, q, isol ) {
194
+
195
+ // cache indices
196
+ const q1 = q + 1,
197
+ qy = q + scope.yd,
198
+ qz = q + scope.zd,
199
+ q1y = q1 + scope.yd,
200
+ q1z = q1 + scope.zd,
201
+ qyz = q + scope.yd + scope.zd,
202
+ q1yz = q1 + scope.yd + scope.zd;
203
+
204
+ let cubeindex = 0;
205
+ const field0 = scope.field[ q ],
206
+ field1 = scope.field[ q1 ],
207
+ field2 = scope.field[ qy ],
208
+ field3 = scope.field[ q1y ],
209
+ field4 = scope.field[ qz ],
210
+ field5 = scope.field[ q1z ],
211
+ field6 = scope.field[ qyz ],
212
+ field7 = scope.field[ q1yz ];
213
+
214
+ if ( field0 < isol ) cubeindex |= 1;
215
+ if ( field1 < isol ) cubeindex |= 2;
216
+ if ( field2 < isol ) cubeindex |= 8;
217
+ if ( field3 < isol ) cubeindex |= 4;
218
+ if ( field4 < isol ) cubeindex |= 16;
219
+ if ( field5 < isol ) cubeindex |= 32;
220
+ if ( field6 < isol ) cubeindex |= 128;
221
+ if ( field7 < isol ) cubeindex |= 64;
222
+
223
+ // if cube is entirely in/out of the surface - bail, nothing to draw
224
+
225
+ const bits = edgeTable[ cubeindex ];
226
+ if ( bits === 0 ) return 0;
227
+
228
+ const d = scope.delta,
229
+ fx2 = fx + d,
230
+ fy2 = fy + d,
231
+ fz2 = fz + d;
232
+
233
+ // top of the cube
234
+
235
+ if ( bits & 1 ) {
236
+
237
+ compNorm( q );
238
+ compNorm( q1 );
239
+ VIntX( q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1 );
240
+
241
+ }
242
+
243
+ if ( bits & 2 ) {
244
+
245
+ compNorm( q1 );
246
+ compNorm( q1y );
247
+ VIntY( q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y );
248
+
249
+ }
250
+
251
+ if ( bits & 4 ) {
252
+
253
+ compNorm( qy );
254
+ compNorm( q1y );
255
+ VIntX( qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y );
256
+
257
+ }
258
+
259
+ if ( bits & 8 ) {
260
+
261
+ compNorm( q );
262
+ compNorm( qy );
263
+ VIntY( q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy );
264
+
265
+ }
266
+
267
+ // bottom of the cube
268
+
269
+ if ( bits & 16 ) {
270
+
271
+ compNorm( qz );
272
+ compNorm( q1z );
273
+ VIntX( qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z );
274
+
275
+ }
276
+
277
+ if ( bits & 32 ) {
278
+
279
+ compNorm( q1z );
280
+ compNorm( q1yz );
281
+ VIntY(
282
+ q1z * 3,
283
+ 15,
284
+ isol,
285
+ fx2,
286
+ fy,
287
+ fz2,
288
+ field5,
289
+ field7,
290
+ q1z,
291
+ q1yz
292
+ );
293
+
294
+ }
295
+
296
+ if ( bits & 64 ) {
297
+
298
+ compNorm( qyz );
299
+ compNorm( q1yz );
300
+ VIntX(
301
+ qyz * 3,
302
+ 18,
303
+ isol,
304
+ fx,
305
+ fy2,
306
+ fz2,
307
+ field6,
308
+ field7,
309
+ qyz,
310
+ q1yz
311
+ );
312
+
313
+ }
314
+
315
+ if ( bits & 128 ) {
316
+
317
+ compNorm( qz );
318
+ compNorm( qyz );
319
+ VIntY( qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz );
320
+
321
+ }
322
+
323
+ // vertical lines of the cube
324
+ if ( bits & 256 ) {
325
+
326
+ compNorm( q );
327
+ compNorm( qz );
328
+ VIntZ( q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz );
329
+
330
+ }
331
+
332
+ if ( bits & 512 ) {
333
+
334
+ compNorm( q1 );
335
+ compNorm( q1z );
336
+ VIntZ( q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z );
337
+
338
+ }
339
+
340
+ if ( bits & 1024 ) {
341
+
342
+ compNorm( q1y );
343
+ compNorm( q1yz );
344
+ VIntZ(
345
+ q1y * 3,
346
+ 30,
347
+ isol,
348
+ fx2,
349
+ fy2,
350
+ fz,
351
+ field3,
352
+ field7,
353
+ q1y,
354
+ q1yz
355
+ );
356
+
357
+ }
358
+
359
+ if ( bits & 2048 ) {
360
+
361
+ compNorm( qy );
362
+ compNorm( qyz );
363
+ VIntZ( qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz );
364
+
365
+ }
366
+
367
+ cubeindex <<= 4; // re-purpose cubeindex into an offset into triTable
368
+
369
+ let o1,
370
+ o2,
371
+ o3,
372
+ numtris = 0,
373
+ i = 0;
374
+
375
+ // here is where triangles are created
376
+
377
+ while ( triTable[ cubeindex + i ] != - 1 ) {
378
+
379
+ o1 = cubeindex + i;
380
+ o2 = o1 + 1;
381
+ o3 = o1 + 2;
382
+
383
+ posnormtriv(
384
+ vlist,
385
+ nlist,
386
+ clist,
387
+ 3 * triTable[ o1 ],
388
+ 3 * triTable[ o2 ],
389
+ 3 * triTable[ o3 ]
390
+ );
391
+
392
+ i += 3;
393
+ numtris ++;
394
+
395
+ }
396
+
397
+ return numtris;
398
+
399
+ }
400
+
401
+ function posnormtriv( pos, norm, colors, o1, o2, o3 ) {
402
+
403
+ const c = scope.count * 3;
404
+
405
+ // positions
406
+
407
+ scope.positionArray[ c + 0 ] = pos[ o1 ];
408
+ scope.positionArray[ c + 1 ] = pos[ o1 + 1 ];
409
+ scope.positionArray[ c + 2 ] = pos[ o1 + 2 ];
410
+
411
+ scope.positionArray[ c + 3 ] = pos[ o2 ];
412
+ scope.positionArray[ c + 4 ] = pos[ o2 + 1 ];
413
+ scope.positionArray[ c + 5 ] = pos[ o2 + 2 ];
414
+
415
+ scope.positionArray[ c + 6 ] = pos[ o3 ];
416
+ scope.positionArray[ c + 7 ] = pos[ o3 + 1 ];
417
+ scope.positionArray[ c + 8 ] = pos[ o3 + 2 ];
418
+
419
+ // normals
420
+
421
+ if ( scope.material.flatShading === true ) {
422
+
423
+ const nx = ( norm[ o1 + 0 ] + norm[ o2 + 0 ] + norm[ o3 + 0 ] ) / 3;
424
+ const ny = ( norm[ o1 + 1 ] + norm[ o2 + 1 ] + norm[ o3 + 1 ] ) / 3;
425
+ const nz = ( norm[ o1 + 2 ] + norm[ o2 + 2 ] + norm[ o3 + 2 ] ) / 3;
426
+
427
+ scope.normalArray[ c + 0 ] = nx;
428
+ scope.normalArray[ c + 1 ] = ny;
429
+ scope.normalArray[ c + 2 ] = nz;
430
+
431
+ scope.normalArray[ c + 3 ] = nx;
432
+ scope.normalArray[ c + 4 ] = ny;
433
+ scope.normalArray[ c + 5 ] = nz;
434
+
435
+ scope.normalArray[ c + 6 ] = nx;
436
+ scope.normalArray[ c + 7 ] = ny;
437
+ scope.normalArray[ c + 8 ] = nz;
438
+
439
+ } else {
440
+
441
+ scope.normalArray[ c + 0 ] = norm[ o1 + 0 ];
442
+ scope.normalArray[ c + 1 ] = norm[ o1 + 1 ];
443
+ scope.normalArray[ c + 2 ] = norm[ o1 + 2 ];
444
+
445
+ scope.normalArray[ c + 3 ] = norm[ o2 + 0 ];
446
+ scope.normalArray[ c + 4 ] = norm[ o2 + 1 ];
447
+ scope.normalArray[ c + 5 ] = norm[ o2 + 2 ];
448
+
449
+ scope.normalArray[ c + 6 ] = norm[ o3 + 0 ];
450
+ scope.normalArray[ c + 7 ] = norm[ o3 + 1 ];
451
+ scope.normalArray[ c + 8 ] = norm[ o3 + 2 ];
452
+
453
+ }
454
+
455
+ // uvs
456
+
457
+ if ( scope.enableUvs ) {
458
+
459
+ const d = scope.count * 2;
460
+
461
+ scope.uvArray[ d + 0 ] = pos[ o1 + 0 ];
462
+ scope.uvArray[ d + 1 ] = pos[ o1 + 2 ];
463
+
464
+ scope.uvArray[ d + 2 ] = pos[ o2 + 0 ];
465
+ scope.uvArray[ d + 3 ] = pos[ o2 + 2 ];
466
+
467
+ scope.uvArray[ d + 4 ] = pos[ o3 + 0 ];
468
+ scope.uvArray[ d + 5 ] = pos[ o3 + 2 ];
469
+
470
+ }
471
+
472
+ // colors
473
+
474
+ if ( scope.enableColors ) {
475
+
476
+ scope.colorArray[ c + 0 ] = colors[ o1 + 0 ];
477
+ scope.colorArray[ c + 1 ] = colors[ o1 + 1 ];
478
+ scope.colorArray[ c + 2 ] = colors[ o1 + 2 ];
479
+
480
+ scope.colorArray[ c + 3 ] = colors[ o2 + 0 ];
481
+ scope.colorArray[ c + 4 ] = colors[ o2 + 1 ];
482
+ scope.colorArray[ c + 5 ] = colors[ o2 + 2 ];
483
+
484
+ scope.colorArray[ c + 6 ] = colors[ o3 + 0 ];
485
+ scope.colorArray[ c + 7 ] = colors[ o3 + 1 ];
486
+ scope.colorArray[ c + 8 ] = colors[ o3 + 2 ];
487
+
488
+ }
489
+
490
+ scope.count += 3;
491
+
492
+ }
493
+
494
+ /////////////////////////////////////
495
+ // Metaballs
496
+ /////////////////////////////////////
497
+
498
+ // Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after
499
+ // a fixed distance, determined by strength and subtract.
500
+
501
+ this.addBall = function ( ballx, bally, ballz, strength, subtract, colors ) {
502
+
503
+ const sign = Math.sign( strength );
504
+ strength = Math.abs( strength );
505
+ const userDefineColor = ! ( colors === undefined || colors === null );
506
+ let ballColor = new Color( ballx, bally, ballz );
507
+
508
+ if ( userDefineColor ) {
509
+
510
+ try {
511
+
512
+ ballColor =
513
+ colors instanceof Color
514
+ ? colors
515
+ : Array.isArray( colors )
516
+ ? new Color(
517
+ Math.min( Math.abs( colors[ 0 ] ), 1 ),
518
+ Math.min( Math.abs( colors[ 1 ] ), 1 ),
519
+ Math.min( Math.abs( colors[ 2 ] ), 1 )
520
+ )
521
+ : new Color( colors );
522
+
523
+ } catch ( err ) {
524
+
525
+ ballColor = new Color( ballx, bally, ballz );
526
+
527
+ }
528
+
529
+ }
530
+
531
+ // Let's solve the equation to find the radius:
532
+ // 1.0 / (0.000001 + radius^2) * strength - subtract = 0
533
+ // strength / (radius^2) = subtract
534
+ // strength = subtract * radius^2
535
+ // radius^2 = strength / subtract
536
+ // radius = sqrt(strength / subtract)
537
+
538
+ const radius = this.size * Math.sqrt( strength / subtract ),
539
+ zs = ballz * this.size,
540
+ ys = bally * this.size,
541
+ xs = ballx * this.size;
542
+
543
+ let min_z = Math.floor( zs - radius );
544
+ if ( min_z < 1 ) min_z = 1;
545
+ let max_z = Math.floor( zs + radius );
546
+ if ( max_z > this.size - 1 ) max_z = this.size - 1;
547
+ let min_y = Math.floor( ys - radius );
548
+ if ( min_y < 1 ) min_y = 1;
549
+ let max_y = Math.floor( ys + radius );
550
+ if ( max_y > this.size - 1 ) max_y = this.size - 1;
551
+ let min_x = Math.floor( xs - radius );
552
+ if ( min_x < 1 ) min_x = 1;
553
+ let max_x = Math.floor( xs + radius );
554
+ if ( max_x > this.size - 1 ) max_x = this.size - 1;
555
+
556
+ // Don't polygonize in the outer layer because normals aren't
557
+ // well-defined there.
558
+
559
+ let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val;
560
+
561
+ for ( z = min_z; z < max_z; z ++ ) {
562
+
563
+ z_offset = this.size2 * z;
564
+ fz = z / this.size - ballz;
565
+ fz2 = fz * fz;
566
+
567
+ for ( y = min_y; y < max_y; y ++ ) {
568
+
569
+ y_offset = z_offset + this.size * y;
570
+ fy = y / this.size - bally;
571
+ fy2 = fy * fy;
572
+
573
+ for ( x = min_x; x < max_x; x ++ ) {
574
+
575
+ fx = x / this.size - ballx;
576
+ val = strength / ( 0.000001 + fx * fx + fy2 + fz2 ) - subtract;
577
+ if ( val > 0.0 ) {
578
+
579
+ this.field[ y_offset + x ] += val * sign;
580
+
581
+ // optimization
582
+ // http://www.geisswerks.com/ryan/BLOBS/blobs.html
583
+ const ratio =
584
+ Math.sqrt( ( x - xs ) * ( x - xs ) + ( y - ys ) * ( y - ys ) + ( z - zs ) * ( z - zs ) ) / radius;
585
+ const contrib =
586
+ 1 - ratio * ratio * ratio * ( ratio * ( ratio * 6 - 15 ) + 10 );
587
+ this.palette[ ( y_offset + x ) * 3 + 0 ] += ballColor.r * contrib;
588
+ this.palette[ ( y_offset + x ) * 3 + 1 ] += ballColor.g * contrib;
589
+ this.palette[ ( y_offset + x ) * 3 + 2 ] += ballColor.b * contrib;
590
+
591
+ }
592
+
593
+ }
594
+
595
+ }
596
+
597
+ }
598
+
599
+ };
600
+
601
+ this.addPlaneX = function ( strength, subtract ) {
602
+
603
+ // cache attribute lookups
604
+ const size = this.size,
605
+ yd = this.yd,
606
+ zd = this.zd,
607
+ field = this.field;
608
+
609
+ let x,
610
+ y,
611
+ z,
612
+ xx,
613
+ val,
614
+ xdiv,
615
+ cxy,
616
+ dist = size * Math.sqrt( strength / subtract );
617
+
618
+ if ( dist > size ) dist = size;
619
+
620
+ for ( x = 0; x < dist; x ++ ) {
621
+
622
+ xdiv = x / size;
623
+ xx = xdiv * xdiv;
624
+ val = strength / ( 0.0001 + xx ) - subtract;
625
+
626
+ if ( val > 0.0 ) {
627
+
628
+ for ( y = 0; y < size; y ++ ) {
629
+
630
+ cxy = x + y * yd;
631
+
632
+ for ( z = 0; z < size; z ++ ) {
633
+
634
+ field[ zd * z + cxy ] += val;
635
+
636
+ }
637
+
638
+ }
639
+
640
+ }
641
+
642
+ }
643
+
644
+ };
645
+
646
+ this.addPlaneY = function ( strength, subtract ) {
647
+
648
+ // cache attribute lookups
649
+ const size = this.size,
650
+ yd = this.yd,
651
+ zd = this.zd,
652
+ field = this.field;
653
+
654
+ let x,
655
+ y,
656
+ z,
657
+ yy,
658
+ val,
659
+ ydiv,
660
+ cy,
661
+ cxy,
662
+ dist = size * Math.sqrt( strength / subtract );
663
+
664
+ if ( dist > size ) dist = size;
665
+
666
+ for ( y = 0; y < dist; y ++ ) {
667
+
668
+ ydiv = y / size;
669
+ yy = ydiv * ydiv;
670
+ val = strength / ( 0.0001 + yy ) - subtract;
671
+
672
+ if ( val > 0.0 ) {
673
+
674
+ cy = y * yd;
675
+
676
+ for ( x = 0; x < size; x ++ ) {
677
+
678
+ cxy = cy + x;
679
+
680
+ for ( z = 0; z < size; z ++ ) field[ zd * z + cxy ] += val;
681
+
682
+ }
683
+
684
+ }
685
+
686
+ }
687
+
688
+ };
689
+
690
+ this.addPlaneZ = function ( strength, subtract ) {
691
+
692
+ // cache attribute lookups
693
+
694
+ const size = this.size,
695
+ yd = this.yd,
696
+ zd = this.zd,
697
+ field = this.field;
698
+
699
+ let x,
700
+ y,
701
+ z,
702
+ zz,
703
+ val,
704
+ zdiv,
705
+ cz,
706
+ cyz,
707
+ dist = size * Math.sqrt( strength / subtract );
708
+
709
+ if ( dist > size ) dist = size;
710
+
711
+ for ( z = 0; z < dist; z ++ ) {
712
+
713
+ zdiv = z / size;
714
+ zz = zdiv * zdiv;
715
+ val = strength / ( 0.0001 + zz ) - subtract;
716
+ if ( val > 0.0 ) {
717
+
718
+ cz = zd * z;
719
+
720
+ for ( y = 0; y < size; y ++ ) {
721
+
722
+ cyz = cz + y * yd;
723
+
724
+ for ( x = 0; x < size; x ++ ) field[ cyz + x ] += val;
725
+
726
+ }
727
+
728
+ }
729
+
730
+ }
731
+
732
+ };
733
+
734
+ /////////////////////////////////////
735
+ // Updates
736
+ /////////////////////////////////////
737
+
738
+ this.setCell = function ( x, y, z, value ) {
739
+
740
+ const index = this.size2 * z + this.size * y + x;
741
+ this.field[ index ] = value;
742
+
743
+ };
744
+
745
+ this.getCell = function ( x, y, z ) {
746
+
747
+ const index = this.size2 * z + this.size * y + x;
748
+ return this.field[ index ];
749
+
750
+ };
751
+
752
+ this.blur = function ( intensity = 1 ) {
753
+
754
+ const field = this.field;
755
+ const fieldCopy = field.slice();
756
+ const size = this.size;
757
+ const size2 = this.size2;
758
+ for ( let x = 0; x < size; x ++ ) {
759
+
760
+ for ( let y = 0; y < size; y ++ ) {
761
+
762
+ for ( let z = 0; z < size; z ++ ) {
763
+
764
+ const index = size2 * z + size * y + x;
765
+ let val = fieldCopy[ index ];
766
+ let count = 1;
767
+
768
+ for ( let x2 = - 1; x2 <= 1; x2 += 2 ) {
769
+
770
+ const x3 = x2 + x;
771
+ if ( x3 < 0 || x3 >= size ) continue;
772
+
773
+ for ( let y2 = - 1; y2 <= 1; y2 += 2 ) {
774
+
775
+ const y3 = y2 + y;
776
+ if ( y3 < 0 || y3 >= size ) continue;
777
+
778
+ for ( let z2 = - 1; z2 <= 1; z2 += 2 ) {
779
+
780
+ const z3 = z2 + z;
781
+ if ( z3 < 0 || z3 >= size ) continue;
782
+
783
+ const index2 = size2 * z3 + size * y3 + x3;
784
+ const val2 = fieldCopy[ index2 ];
785
+
786
+ count ++;
787
+ val += intensity * ( val2 - val ) / count;
788
+
789
+ }
790
+
791
+ }
792
+
793
+ }
794
+
795
+ field[ index ] = val;
796
+
797
+ }
798
+
799
+ }
800
+
801
+ }
802
+
803
+ };
804
+
805
+ this.reset = function () {
806
+
807
+ // wipe the normal cache
808
+
809
+ for ( let i = 0; i < this.size3; i ++ ) {
810
+
811
+ this.normal_cache[ i * 3 ] = 0.0;
812
+ this.field[ i ] = 0.0;
813
+ this.palette[ i * 3 ] = this.palette[ i * 3 + 1 ] = this.palette[
814
+ i * 3 + 2
815
+ ] = 0.0;
816
+
817
+ }
818
+
819
+ };
820
+
821
+ this.update = function () {
822
+
823
+ this.count = 0;
824
+
825
+ // Triangulate. Yeah, this is slow.
826
+
827
+ const smin2 = this.size - 2;
828
+
829
+ for ( let z = 1; z < smin2; z ++ ) {
830
+
831
+ const z_offset = this.size2 * z;
832
+ const fz = ( z - this.halfsize ) / this.halfsize; //+ 1
833
+
834
+ for ( let y = 1; y < smin2; y ++ ) {
835
+
836
+ const y_offset = z_offset + this.size * y;
837
+ const fy = ( y - this.halfsize ) / this.halfsize; //+ 1
838
+
839
+ for ( let x = 1; x < smin2; x ++ ) {
840
+
841
+ const fx = ( x - this.halfsize ) / this.halfsize; //+ 1
842
+ const q = y_offset + x;
843
+
844
+ polygonize( fx, fy, fz, q, this.isolation );
845
+
846
+ }
847
+
848
+ }
849
+
850
+ }
851
+
852
+ // set the draw range to only the processed triangles
853
+
854
+ this.geometry.setDrawRange( 0, this.count );
855
+
856
+ // update geometry data
857
+
858
+ geometry.getAttribute( 'position' ).needsUpdate = true;
859
+ geometry.getAttribute( 'normal' ).needsUpdate = true;
860
+
861
+ if ( this.enableUvs ) geometry.getAttribute( 'uv' ).needsUpdate = true;
862
+ if ( this.enableColors ) geometry.getAttribute( 'color' ).needsUpdate = true;
863
+
864
+ // safety check
865
+
866
+ if ( this.count / 3 > maxPolyCount ) console.warn( 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.' );
867
+
868
+ };
869
+
870
+ this.init( resolution );
871
+
872
+ }
873
+
874
+ }
875
+
876
+ /////////////////////////////////////
877
+ // Marching cubes lookup tables
878
+ /////////////////////////////////////
879
+
880
+ // These tables are straight from Paul Bourke's page:
881
+ // http://paulbourke.net/geometry/polygonise/
882
+ // who in turn got them from Cory Gene Bloyd.
883
+
884
+ const edgeTable = new Int32Array( [
885
+ 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
886
+ 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
887
+ 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
888
+ 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
889
+ 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,
890
+ 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
891
+ 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,
892
+ 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
893
+ 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,
894
+ 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
895
+ 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,
896
+ 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
897
+ 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,
898
+ 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
899
+ 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,
900
+ 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
901
+ 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
902
+ 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
903
+ 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
904
+ 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
905
+ 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
906
+ 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
907
+ 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
908
+ 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,
909
+ 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
910
+ 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,
911
+ 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
912
+ 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,
913
+ 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
914
+ 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,
915
+ 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
916
+ 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] );
917
+
918
+ const triTable = new Int32Array( [
919
+ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
920
+ 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
921
+ 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
922
+ 1, 8, 3, 9, 8, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
923
+ 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
924
+ 0, 8, 3, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
925
+ 9, 2, 10, 0, 2, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
926
+ 2, 8, 3, 2, 10, 8, 10, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
927
+ 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
928
+ 0, 11, 2, 8, 11, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
929
+ 1, 9, 0, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
930
+ 1, 11, 2, 1, 9, 11, 9, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
931
+ 3, 10, 1, 11, 10, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
932
+ 0, 10, 1, 0, 8, 10, 8, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
933
+ 3, 9, 0, 3, 11, 9, 11, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
934
+ 9, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
935
+ 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
936
+ 4, 3, 0, 7, 3, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
937
+ 0, 1, 9, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
938
+ 4, 1, 9, 4, 7, 1, 7, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
939
+ 1, 2, 10, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
940
+ 3, 4, 7, 3, 0, 4, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
941
+ 9, 2, 10, 9, 0, 2, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
942
+ 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,
943
+ 8, 4, 7, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
944
+ 11, 4, 7, 11, 2, 4, 2, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
945
+ 9, 0, 1, 8, 4, 7, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
946
+ 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, - 1, - 1, - 1, - 1,
947
+ 3, 10, 1, 3, 11, 10, 7, 8, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
948
+ 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, - 1, - 1, - 1, - 1,
949
+ 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,
950
+ 4, 7, 11, 4, 11, 9, 9, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
951
+ 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
952
+ 9, 5, 4, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
953
+ 0, 5, 4, 1, 5, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
954
+ 8, 5, 4, 8, 3, 5, 3, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
955
+ 1, 2, 10, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
956
+ 3, 0, 8, 1, 2, 10, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
957
+ 5, 2, 10, 5, 4, 2, 4, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
958
+ 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, - 1, - 1, - 1, - 1,
959
+ 9, 5, 4, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
960
+ 0, 11, 2, 0, 8, 11, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
961
+ 0, 5, 4, 0, 1, 5, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
962
+ 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, - 1, - 1, - 1, - 1,
963
+ 10, 3, 11, 10, 1, 3, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
964
+ 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, - 1, - 1, - 1, - 1,
965
+ 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1,
966
+ 5, 4, 8, 5, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
967
+ 9, 7, 8, 5, 7, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
968
+ 9, 3, 0, 9, 5, 3, 5, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
969
+ 0, 7, 8, 0, 1, 7, 1, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
970
+ 1, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
971
+ 9, 7, 8, 9, 5, 7, 10, 1, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
972
+ 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, - 1, - 1, - 1, - 1,
973
+ 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, - 1, - 1, - 1, - 1,
974
+ 2, 10, 5, 2, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
975
+ 7, 9, 5, 7, 8, 9, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
976
+ 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,
977
+ 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, - 1, - 1, - 1, - 1,
978
+ 11, 2, 1, 11, 1, 7, 7, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
979
+ 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, - 1, - 1, - 1, - 1,
980
+ 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, - 1,
981
+ 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, - 1,
982
+ 11, 10, 5, 7, 11, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
983
+ 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
984
+ 0, 8, 3, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
985
+ 9, 0, 1, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
986
+ 1, 8, 3, 1, 9, 8, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
987
+ 1, 6, 5, 2, 6, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
988
+ 1, 6, 5, 1, 2, 6, 3, 0, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
989
+ 9, 6, 5, 9, 0, 6, 0, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
990
+ 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, - 1, - 1, - 1, - 1,
991
+ 2, 3, 11, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
992
+ 11, 0, 8, 11, 2, 0, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
993
+ 0, 1, 9, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
994
+ 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, - 1, - 1, - 1, - 1,
995
+ 6, 3, 11, 6, 5, 3, 5, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
996
+ 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,
997
+ 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, - 1, - 1, - 1, - 1,
998
+ 6, 5, 9, 6, 9, 11, 11, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
999
+ 5, 10, 6, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1000
+ 4, 3, 0, 4, 7, 3, 6, 5, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1001
+ 1, 9, 0, 5, 10, 6, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1002
+ 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1,
1003
+ 6, 1, 2, 6, 5, 1, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1004
+ 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, - 1, - 1, - 1, - 1,
1005
+ 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, - 1, - 1, - 1, - 1,
1006
+ 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, - 1,
1007
+ 3, 11, 2, 7, 8, 4, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1008
+ 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1,
1009
+ 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1,
1010
+ 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, - 1,
1011
+ 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1,
1012
+ 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, - 1,
1013
+ 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, - 1,
1014
+ 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, - 1, - 1, - 1, - 1,
1015
+ 10, 4, 9, 6, 4, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1016
+ 4, 10, 6, 4, 9, 10, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1017
+ 10, 0, 1, 10, 6, 0, 6, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1018
+ 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,
1019
+ 1, 4, 9, 1, 2, 4, 2, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1020
+ 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, - 1, - 1, - 1, - 1,
1021
+ 0, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1022
+ 8, 3, 2, 8, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1023
+ 10, 4, 9, 10, 6, 4, 11, 2, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1024
+ 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, - 1, - 1, - 1, - 1,
1025
+ 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1,
1026
+ 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, - 1,
1027
+ 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, - 1, - 1, - 1, - 1,
1028
+ 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, - 1,
1029
+ 3, 11, 6, 3, 6, 0, 0, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1030
+ 6, 4, 8, 11, 6, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1031
+ 7, 10, 6, 7, 8, 10, 8, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1032
+ 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, - 1, - 1, - 1, - 1,
1033
+ 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, - 1, - 1, - 1, - 1,
1034
+ 10, 6, 7, 10, 7, 1, 1, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1035
+ 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,
1036
+ 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, - 1,
1037
+ 7, 8, 0, 7, 0, 6, 6, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1038
+ 7, 3, 2, 6, 7, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1039
+ 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1,
1040
+ 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, - 1,
1041
+ 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, - 1,
1042
+ 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, - 1, - 1, - 1, - 1,
1043
+ 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, - 1,
1044
+ 0, 9, 1, 11, 6, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1045
+ 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, - 1, - 1, - 1, - 1,
1046
+ 7, 11, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1047
+ 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1048
+ 3, 0, 8, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1049
+ 0, 1, 9, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1050
+ 8, 1, 9, 8, 3, 1, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1051
+ 10, 1, 2, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1052
+ 1, 2, 10, 3, 0, 8, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1053
+ 2, 9, 0, 2, 10, 9, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1054
+ 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, - 1, - 1, - 1, - 1,
1055
+ 7, 2, 3, 6, 2, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1056
+ 7, 0, 8, 7, 6, 0, 6, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1057
+ 2, 7, 6, 2, 3, 7, 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1058
+ 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, - 1, - 1, - 1, - 1,
1059
+ 10, 7, 6, 10, 1, 7, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1060
+ 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, - 1, - 1, - 1, - 1,
1061
+ 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, - 1, - 1, - 1, - 1,
1062
+ 7, 6, 10, 7, 10, 8, 8, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1063
+ 6, 8, 4, 11, 8, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1064
+ 3, 6, 11, 3, 0, 6, 0, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1065
+ 8, 6, 11, 8, 4, 6, 9, 0, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1066
+ 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, - 1, - 1, - 1, - 1,
1067
+ 6, 8, 4, 6, 11, 8, 2, 10, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1068
+ 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, - 1, - 1, - 1, - 1,
1069
+ 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, - 1, - 1, - 1, - 1,
1070
+ 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, - 1,
1071
+ 8, 2, 3, 8, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1072
+ 0, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1073
+ 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, - 1, - 1, - 1, - 1,
1074
+ 1, 9, 4, 1, 4, 2, 2, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1075
+ 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, - 1, - 1, - 1, - 1,
1076
+ 10, 1, 0, 10, 0, 6, 6, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1077
+ 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, - 1,
1078
+ 10, 9, 4, 6, 10, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1079
+ 4, 9, 5, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1080
+ 0, 8, 3, 4, 9, 5, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1081
+ 5, 0, 1, 5, 4, 0, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1082
+ 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, - 1, - 1, - 1, - 1,
1083
+ 9, 5, 4, 10, 1, 2, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1084
+ 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, - 1, - 1, - 1, - 1,
1085
+ 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, - 1, - 1, - 1, - 1,
1086
+ 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, - 1,
1087
+ 7, 2, 3, 7, 6, 2, 5, 4, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1088
+ 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, - 1, - 1, - 1, - 1,
1089
+ 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, - 1, - 1, - 1, - 1,
1090
+ 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, - 1,
1091
+ 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, - 1, - 1, - 1, - 1,
1092
+ 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, - 1,
1093
+ 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, - 1,
1094
+ 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, - 1, - 1, - 1, - 1,
1095
+ 6, 9, 5, 6, 11, 9, 11, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1096
+ 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, - 1, - 1, - 1, - 1,
1097
+ 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, - 1, - 1, - 1, - 1,
1098
+ 6, 11, 3, 6, 3, 5, 5, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1099
+ 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, - 1, - 1, - 1, - 1,
1100
+ 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, - 1,
1101
+ 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, - 1,
1102
+ 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, - 1, - 1, - 1, - 1,
1103
+ 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, - 1, - 1, - 1, - 1,
1104
+ 9, 5, 6, 9, 6, 0, 0, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1105
+ 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, - 1,
1106
+ 1, 5, 6, 2, 1, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1107
+ 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, - 1,
1108
+ 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, - 1, - 1, - 1, - 1,
1109
+ 0, 3, 8, 5, 6, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1110
+ 10, 5, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1111
+ 11, 5, 10, 7, 5, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1112
+ 11, 5, 10, 11, 7, 5, 8, 3, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1113
+ 5, 11, 7, 5, 10, 11, 1, 9, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1114
+ 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, - 1, - 1, - 1, - 1,
1115
+ 11, 1, 2, 11, 7, 1, 7, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1116
+ 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, - 1, - 1, - 1, - 1,
1117
+ 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, - 1, - 1, - 1, - 1,
1118
+ 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, - 1,
1119
+ 2, 5, 10, 2, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1120
+ 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, - 1, - 1, - 1, - 1,
1121
+ 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, - 1, - 1, - 1, - 1,
1122
+ 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, - 1,
1123
+ 1, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1124
+ 0, 8, 7, 0, 7, 1, 1, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1125
+ 9, 0, 3, 9, 3, 5, 5, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1126
+ 9, 8, 7, 5, 9, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1127
+ 5, 8, 4, 5, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1128
+ 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, - 1, - 1, - 1, - 1,
1129
+ 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, - 1, - 1, - 1, - 1,
1130
+ 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, - 1,
1131
+ 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, - 1, - 1, - 1, - 1,
1132
+ 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, - 1,
1133
+ 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, - 1,
1134
+ 9, 4, 5, 2, 11, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1135
+ 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, - 1, - 1, - 1, - 1,
1136
+ 5, 10, 2, 5, 2, 4, 4, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1137
+ 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, - 1,
1138
+ 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, - 1, - 1, - 1, - 1,
1139
+ 8, 4, 5, 8, 5, 3, 3, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1140
+ 0, 4, 5, 1, 0, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1141
+ 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, - 1, - 1, - 1, - 1,
1142
+ 9, 4, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1143
+ 4, 11, 7, 4, 9, 11, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1144
+ 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, - 1, - 1, - 1, - 1,
1145
+ 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, - 1, - 1, - 1, - 1,
1146
+ 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, - 1,
1147
+ 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, - 1, - 1, - 1, - 1,
1148
+ 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, - 1,
1149
+ 11, 7, 4, 11, 4, 2, 2, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1150
+ 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, - 1, - 1, - 1, - 1,
1151
+ 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, - 1, - 1, - 1, - 1,
1152
+ 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, - 1,
1153
+ 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, - 1,
1154
+ 1, 10, 2, 8, 7, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1155
+ 4, 9, 1, 4, 1, 7, 7, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1156
+ 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, - 1, - 1, - 1, - 1,
1157
+ 4, 0, 3, 7, 4, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1158
+ 4, 8, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1159
+ 9, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1160
+ 3, 0, 9, 3, 9, 11, 11, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1161
+ 0, 1, 10, 0, 10, 8, 8, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1162
+ 3, 1, 10, 11, 3, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1163
+ 1, 2, 11, 1, 11, 9, 9, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1164
+ 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, - 1, - 1, - 1, - 1,
1165
+ 0, 2, 11, 8, 0, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1166
+ 3, 2, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1167
+ 2, 3, 8, 2, 8, 10, 10, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1168
+ 9, 10, 2, 0, 9, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1169
+ 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, - 1, - 1, - 1, - 1,
1170
+ 1, 10, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1171
+ 1, 3, 8, 9, 1, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1172
+ 0, 9, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1173
+ 0, 3, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1,
1174
+ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 ] );
1175
+
1176
+ export { MarchingCubes, edgeTable, triTable };