@needle-tools/three 0.160.2 → 0.162.1

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 (961) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +86 -86
  3. package/build/three.cjs +53267 -53092
  4. package/build/three.module.js +53269 -53094
  5. package/build/three.module.min.js +1 -1
  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 +295 -294
  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 -108
  18. package/examples/jsm/capabilities/WebGPU.js +57 -57
  19. package/examples/jsm/controls/ArcballControls.js +3224 -3224
  20. package/examples/jsm/controls/DragControls.js +282 -221
  21. package/examples/jsm/controls/FirstPersonControls.js +325 -325
  22. package/examples/jsm/controls/FlyControls.js +326 -326
  23. package/examples/jsm/controls/MapControls.js +28 -28
  24. package/examples/jsm/controls/OrbitControls.js +1548 -1521
  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 -1573
  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 -295
  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 +542 -487
  36. package/examples/jsm/curves/NURBSVolume.js +62 -0
  37. package/examples/jsm/effects/AnaglyphEffect.js +154 -154
  38. package/examples/jsm/effects/AsciiEffect.js +263 -263
  39. package/examples/jsm/effects/OutlineEffect.js +539 -539
  40. package/examples/jsm/effects/ParallaxBarrierEffect.js +119 -119
  41. package/examples/jsm/effects/PeppersGhostEffect.js +153 -153
  42. package/examples/jsm/effects/StereoEffect.js +55 -55
  43. package/examples/jsm/environments/DebugEnvironment.js +52 -52
  44. package/examples/jsm/environments/RoomEnvironment.js +148 -148
  45. package/examples/jsm/exporters/DRACOExporter.js +267 -267
  46. package/examples/jsm/exporters/EXRExporter.js +579 -579
  47. package/examples/jsm/exporters/GLTFExporter.js +3321 -3311
  48. package/examples/jsm/exporters/KTX2Exporter.js +292 -292
  49. package/examples/jsm/exporters/MMDExporter.js +217 -217
  50. package/examples/jsm/exporters/OBJExporter.js +284 -284
  51. package/examples/jsm/exporters/PLYExporter.js +528 -528
  52. package/examples/jsm/exporters/STLExporter.js +199 -199
  53. package/examples/jsm/exporters/USDZExporter.js +720 -720
  54. package/examples/jsm/geometries/BoxLineGeometry.js +69 -69
  55. package/examples/jsm/geometries/ConvexGeometry.js +53 -53
  56. package/examples/jsm/geometries/DecalGeometry.js +356 -356
  57. package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -174
  58. package/examples/jsm/geometries/ParametricGeometries.js +254 -254
  59. package/examples/jsm/geometries/ParametricGeometry.js +139 -139
  60. package/examples/jsm/geometries/RoundedBoxGeometry.js +155 -155
  61. package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -144
  62. package/examples/jsm/geometries/TeapotGeometry.js +704 -704
  63. package/examples/jsm/geometries/TextGeometry.js +57 -57
  64. package/examples/jsm/helpers/LightProbeHelper.js +130 -130
  65. package/examples/jsm/helpers/OctreeHelper.js +73 -73
  66. package/examples/jsm/helpers/PositionalAudioHelper.js +109 -109
  67. package/examples/jsm/helpers/RectAreaLightHelper.js +85 -85
  68. package/examples/jsm/helpers/TextureHelper.js +237 -237
  69. package/examples/jsm/helpers/VertexNormalsHelper.js +96 -96
  70. package/examples/jsm/helpers/VertexTangentsHelper.js +88 -88
  71. package/examples/jsm/helpers/ViewHelper.js +333 -333
  72. package/examples/jsm/interactive/HTMLMesh.js +572 -572
  73. package/examples/jsm/interactive/InteractiveGroup.js +106 -116
  74. package/examples/jsm/interactive/SelectionBox.js +227 -227
  75. package/examples/jsm/interactive/SelectionHelper.js +104 -104
  76. package/examples/jsm/libs/ammo.wasm.js +822 -822
  77. package/examples/jsm/libs/basis/README.md +46 -46
  78. package/examples/jsm/libs/basis/basis_transcoder.js +21 -21
  79. package/examples/jsm/libs/chevrotain.module.min.js +141 -141
  80. package/examples/jsm/libs/draco/README.md +32 -32
  81. package/examples/jsm/libs/draco/draco_decoder.js +34 -34
  82. package/examples/jsm/libs/draco/draco_encoder.js +33 -33
  83. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -117
  84. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -33
  85. package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -33
  86. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -116
  87. package/examples/jsm/libs/ecsy.module.js +1792 -1792
  88. package/examples/jsm/libs/fflate.module.js +2474 -2474
  89. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  90. package/examples/jsm/libs/lil-gui.module.min.js +8 -8
  91. package/examples/jsm/libs/lottie_canvas.module.js +14849 -14849
  92. package/examples/jsm/libs/meshopt_decoder.module.js +178 -178
  93. package/examples/jsm/libs/mikktspace.module.js +128 -128
  94. package/examples/jsm/libs/mmdparser.module.js +11530 -11530
  95. package/examples/jsm/libs/motion-controllers.module.js +397 -397
  96. package/examples/jsm/libs/opentype.module.js +14506 -14506
  97. package/examples/jsm/libs/potpack.module.js +124 -124
  98. package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -8743
  99. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +15 -8748
  100. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  101. package/examples/jsm/libs/stats.module.js +167 -167
  102. package/examples/jsm/libs/surfaceNet.js +200 -200
  103. package/examples/jsm/libs/tween.module.js +876 -858
  104. package/examples/jsm/libs/utif.module.js +1664 -1664
  105. package/examples/jsm/libs/zstddec.module.js +1 -1
  106. package/examples/jsm/lights/IESSpotLight.js +25 -25
  107. package/examples/jsm/lights/LightProbeGenerator.js +286 -286
  108. package/examples/jsm/lights/RectAreaLightUniformsLib.js +79 -79
  109. package/examples/jsm/lines/Line2.js +19 -19
  110. package/examples/jsm/lines/LineGeometry.js +79 -79
  111. package/examples/jsm/lines/LineMaterial.js +619 -619
  112. package/examples/jsm/lines/LineSegments2.js +361 -361
  113. package/examples/jsm/lines/LineSegmentsGeometry.js +241 -241
  114. package/examples/jsm/lines/Wireframe.js +56 -56
  115. package/examples/jsm/lines/WireframeGeometry2.js +24 -24
  116. package/examples/jsm/loaders/3DMLoader.js +1764 -1772
  117. package/examples/jsm/loaders/3MFLoader.js +1478 -1478
  118. package/examples/jsm/loaders/AMFLoader.js +521 -521
  119. package/examples/jsm/loaders/BVHLoader.js +437 -437
  120. package/examples/jsm/loaders/ColladaLoader.js +4116 -4116
  121. package/examples/jsm/loaders/DDSLoader.js +318 -318
  122. package/examples/jsm/loaders/DRACOLoader.js +613 -613
  123. package/examples/jsm/loaders/EXRLoader.js +2309 -2309
  124. package/examples/jsm/loaders/FBXLoader.js +4314 -4314
  125. package/examples/jsm/loaders/FontLoader.js +183 -183
  126. package/examples/jsm/loaders/GCodeLoader.js +261 -261
  127. package/examples/jsm/loaders/GLTFLoader.js +4666 -4666
  128. package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +729 -720
  129. package/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -115
  130. package/examples/jsm/loaders/IESLoader.js +337 -337
  131. package/examples/jsm/loaders/KMZLoader.js +130 -130
  132. package/examples/jsm/loaders/KTX2Loader.js +932 -932
  133. package/examples/jsm/loaders/KTXLoader.js +176 -176
  134. package/examples/jsm/loaders/LDrawLoader.js +2470 -2470
  135. package/examples/jsm/loaders/LUT3dlLoader.js +183 -183
  136. package/examples/jsm/loaders/LUTCubeLoader.js +167 -167
  137. package/examples/jsm/loaders/LUTImageLoader.js +163 -163
  138. package/examples/jsm/loaders/LWOLoader.js +1052 -1052
  139. package/examples/jsm/loaders/LogLuvLoader.js +606 -606
  140. package/examples/jsm/loaders/LottieLoader.js +77 -77
  141. package/examples/jsm/loaders/MD2Loader.js +399 -399
  142. package/examples/jsm/loaders/MDDLoader.js +102 -102
  143. package/examples/jsm/loaders/MMDLoader.js +2276 -2276
  144. package/examples/jsm/loaders/MTLLoader.js +567 -567
  145. package/examples/jsm/loaders/MaterialXLoader.js +852 -852
  146. package/examples/jsm/loaders/NRRDLoader.js +686 -686
  147. package/examples/jsm/loaders/OBJLoader.js +905 -905
  148. package/examples/jsm/loaders/PCDLoader.js +467 -467
  149. package/examples/jsm/loaders/PDBLoader.js +232 -232
  150. package/examples/jsm/loaders/PLYLoader.js +771 -771
  151. package/examples/jsm/loaders/PVRLoader.js +251 -251
  152. package/examples/jsm/loaders/RGBELoader.js +450 -450
  153. package/examples/jsm/loaders/RGBMLoader.js +1065 -1065
  154. package/examples/jsm/loaders/STLLoader.js +410 -410
  155. package/examples/jsm/loaders/SVGLoader.js +3173 -3173
  156. package/examples/jsm/loaders/TDSLoader.js +1124 -1124
  157. package/examples/jsm/loaders/TGALoader.js +517 -517
  158. package/examples/jsm/loaders/TIFFLoader.js +36 -36
  159. package/examples/jsm/loaders/TTFLoader.js +214 -214
  160. package/examples/jsm/loaders/TiltLoader.js +520 -520
  161. package/examples/jsm/loaders/USDZLoader.js +822 -822
  162. package/examples/jsm/loaders/VOXLoader.js +318 -311
  163. package/examples/jsm/loaders/VRMLLoader.js +3537 -3533
  164. package/examples/jsm/loaders/VTKLoader.js +1163 -1163
  165. package/examples/jsm/loaders/XYZLoader.js +106 -106
  166. package/examples/jsm/loaders/lwo/IFFParser.js +1214 -1214
  167. package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -414
  168. package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -373
  169. package/examples/jsm/materials/MeshGouraudMaterial.js +426 -426
  170. package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -144
  171. package/examples/jsm/math/Capsule.js +82 -82
  172. package/examples/jsm/math/ColorConverter.js +36 -36
  173. package/examples/jsm/math/ConvexHull.js +1271 -1271
  174. package/examples/jsm/math/ImprovedNoise.js +71 -71
  175. package/examples/jsm/math/Lut.js +204 -204
  176. package/examples/jsm/math/MeshSurfaceSampler.js +250 -250
  177. package/examples/jsm/math/OBB.js +423 -423
  178. package/examples/jsm/math/Octree.js +540 -540
  179. package/examples/jsm/math/SimplexNoise.js +444 -444
  180. package/examples/jsm/misc/ConvexObjectBreaker.js +519 -519
  181. package/examples/jsm/misc/GPUComputationRenderer.js +446 -446
  182. package/examples/jsm/misc/Gyroscope.js +66 -66
  183. package/examples/jsm/misc/MD2Character.js +276 -276
  184. package/examples/jsm/misc/MD2CharacterComplex.js +576 -576
  185. package/examples/jsm/misc/MorphAnimMesh.js +75 -75
  186. package/examples/jsm/misc/MorphBlendMesh.js +322 -322
  187. package/examples/jsm/misc/ProgressiveLightMap.js +324 -323
  188. package/examples/jsm/misc/RollerCoaster.js +566 -566
  189. package/examples/jsm/misc/Timer.js +128 -119
  190. package/examples/jsm/misc/TubePainter.js +202 -202
  191. package/examples/jsm/misc/Volume.js +473 -473
  192. package/examples/jsm/misc/VolumeSlice.js +229 -229
  193. package/examples/jsm/modifiers/CurveModifier.js +344 -344
  194. package/examples/jsm/modifiers/EdgeSplitModifier.js +279 -279
  195. package/examples/jsm/modifiers/SimplifyModifier.js +617 -617
  196. package/examples/jsm/modifiers/TessellateModifier.js +307 -307
  197. package/examples/jsm/nodes/Nodes.js +195 -189
  198. package/examples/jsm/nodes/accessors/AccessorsUtils.js +10 -0
  199. package/examples/jsm/nodes/accessors/BitangentNode.js +89 -89
  200. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +127 -127
  201. package/examples/jsm/nodes/accessors/BufferNode.js +30 -30
  202. package/examples/jsm/nodes/accessors/CameraNode.js +119 -120
  203. package/examples/jsm/nodes/accessors/ClippingNode.js +144 -0
  204. package/examples/jsm/nodes/accessors/CubeTextureNode.js +61 -61
  205. package/examples/jsm/nodes/accessors/InstanceNode.js +71 -71
  206. package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -21
  207. package/examples/jsm/nodes/accessors/MaterialNode.js +314 -314
  208. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +41 -51
  209. package/examples/jsm/nodes/accessors/ModelNode.js +33 -33
  210. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +39 -39
  211. package/examples/jsm/nodes/accessors/MorphNode.js +245 -245
  212. package/examples/jsm/nodes/accessors/NormalNode.js +96 -96
  213. package/examples/jsm/nodes/accessors/Object3DNode.js +150 -150
  214. package/examples/jsm/nodes/accessors/PointUVNode.js +26 -26
  215. package/examples/jsm/nodes/accessors/PositionNode.js +104 -104
  216. package/examples/jsm/nodes/accessors/ReferenceNode.js +160 -102
  217. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +35 -35
  218. package/examples/jsm/nodes/accessors/SceneNode.js +52 -52
  219. package/examples/jsm/nodes/accessors/SkinningNode.js +124 -103
  220. package/examples/jsm/nodes/accessors/StorageBufferNode.js +72 -54
  221. package/examples/jsm/nodes/accessors/TangentNode.js +109 -103
  222. package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -94
  223. package/examples/jsm/nodes/accessors/TextureNode.js +367 -367
  224. package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -35
  225. package/examples/jsm/nodes/accessors/TextureStoreNode.js +82 -82
  226. package/examples/jsm/nodes/accessors/UVNode.js +47 -47
  227. package/examples/jsm/nodes/accessors/UniformsNode.js +140 -0
  228. package/examples/jsm/nodes/accessors/UserDataNode.js +29 -29
  229. package/examples/jsm/nodes/accessors/VertexColorNode.js +70 -70
  230. package/examples/jsm/nodes/code/CodeNode.js +84 -78
  231. package/examples/jsm/nodes/code/ExpressionNode.js +37 -37
  232. package/examples/jsm/nodes/code/FunctionCallNode.js +96 -96
  233. package/examples/jsm/nodes/code/FunctionNode.js +138 -138
  234. package/examples/jsm/nodes/code/ScriptableNode.js +488 -488
  235. package/examples/jsm/nodes/code/ScriptableValueNode.js +167 -167
  236. package/examples/jsm/nodes/core/AssignNode.js +128 -72
  237. package/examples/jsm/nodes/core/AttributeNode.js +108 -108
  238. package/examples/jsm/nodes/core/BypassNode.js +45 -45
  239. package/examples/jsm/nodes/core/CacheNode.js +49 -49
  240. package/examples/jsm/nodes/core/ConstNode.js +32 -32
  241. package/examples/jsm/nodes/core/ContextNode.js +61 -61
  242. package/examples/jsm/nodes/core/IndexNode.js +66 -66
  243. package/examples/jsm/nodes/core/InputNode.js +83 -83
  244. package/examples/jsm/nodes/core/LightingModel.js +17 -17
  245. package/examples/jsm/nodes/core/Node.js +493 -483
  246. package/examples/jsm/nodes/core/NodeAttribute.js +15 -15
  247. package/examples/jsm/nodes/core/NodeBuilder.js +1250 -1267
  248. package/examples/jsm/nodes/core/NodeCache.js +26 -26
  249. package/examples/jsm/nodes/core/NodeCode.js +15 -15
  250. package/examples/jsm/nodes/core/NodeFrame.js +143 -135
  251. package/examples/jsm/nodes/core/NodeFunction.js +22 -22
  252. package/examples/jsm/nodes/core/NodeFunctionInput.js +17 -17
  253. package/examples/jsm/nodes/core/NodeKeywords.js +80 -80
  254. package/examples/jsm/nodes/core/NodeParser.js +11 -11
  255. package/examples/jsm/nodes/core/NodeUniform.js +40 -40
  256. package/examples/jsm/nodes/core/NodeUtils.js +210 -210
  257. package/examples/jsm/nodes/core/NodeVar.js +14 -14
  258. package/examples/jsm/nodes/core/NodeVarying.js +17 -17
  259. package/examples/jsm/nodes/core/OutputStructNode.js +62 -62
  260. package/examples/jsm/nodes/core/ParameterNode.js +33 -33
  261. package/examples/jsm/nodes/core/PropertyNode.js +72 -72
  262. package/examples/jsm/nodes/core/StackNode.js +89 -89
  263. package/examples/jsm/nodes/core/StructTypeNode.js +24 -24
  264. package/examples/jsm/nodes/core/TempNode.js +58 -58
  265. package/examples/jsm/nodes/core/UniformGroup.js +13 -13
  266. package/examples/jsm/nodes/core/UniformGroupNode.js +36 -36
  267. package/examples/jsm/nodes/core/UniformNode.js +80 -80
  268. package/examples/jsm/nodes/core/VarNode.js +60 -60
  269. package/examples/jsm/nodes/core/VaryingNode.js +65 -65
  270. package/examples/jsm/nodes/core/constants.js +28 -27
  271. package/examples/jsm/nodes/display/AfterImageNode.js +148 -134
  272. package/examples/jsm/nodes/display/AnamorphicNode.js +148 -0
  273. package/examples/jsm/nodes/display/BlendModeNode.js +128 -99
  274. package/examples/jsm/nodes/display/BumpMapNode.js +99 -99
  275. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +99 -96
  276. package/examples/jsm/nodes/display/ColorSpaceNode.js +108 -108
  277. package/examples/jsm/nodes/display/FrontFacingNode.js +27 -27
  278. package/examples/jsm/nodes/display/GaussianBlurNode.js +190 -177
  279. package/examples/jsm/nodes/display/NormalMapNode.js +106 -108
  280. package/examples/jsm/nodes/display/PassNode.js +183 -182
  281. package/examples/jsm/nodes/display/PosterizeNode.js +32 -32
  282. package/examples/jsm/nodes/display/ToneMappingNode.js +184 -184
  283. package/examples/jsm/nodes/display/ViewportDepthNode.js +97 -97
  284. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +31 -31
  285. package/examples/jsm/nodes/display/ViewportNode.js +134 -134
  286. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +31 -31
  287. package/examples/jsm/nodes/display/ViewportTextureNode.js +75 -75
  288. package/examples/jsm/nodes/fog/FogExp2Node.js +35 -35
  289. package/examples/jsm/nodes/fog/FogNode.js +38 -38
  290. package/examples/jsm/nodes/fog/FogRangeNode.js +34 -34
  291. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +40 -40
  292. package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -9
  293. package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +57 -57
  294. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +30 -30
  295. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +23 -23
  296. package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -13
  297. package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +16 -16
  298. package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +21 -21
  299. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +28 -28
  300. package/examples/jsm/nodes/functions/PhongLightingModel.js +67 -67
  301. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +393 -393
  302. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +13 -13
  303. package/examples/jsm/nodes/functions/material/getRoughness.js +18 -18
  304. package/examples/jsm/nodes/geometry/RangeNode.js +104 -104
  305. package/examples/jsm/nodes/gpgpu/ComputeNode.js +85 -85
  306. package/examples/jsm/nodes/lighting/AONode.js +27 -27
  307. package/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -27
  308. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +241 -238
  309. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +40 -40
  310. package/examples/jsm/nodes/lighting/EnvironmentNode.js +181 -181
  311. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +55 -55
  312. package/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -39
  313. package/examples/jsm/nodes/lighting/LightNode.js +57 -57
  314. package/examples/jsm/nodes/lighting/LightUtils.js +17 -17
  315. package/examples/jsm/nodes/lighting/LightingContextNode.js +66 -66
  316. package/examples/jsm/nodes/lighting/LightingNode.js +21 -21
  317. package/examples/jsm/nodes/lighting/LightsNode.js +188 -188
  318. package/examples/jsm/nodes/lighting/PointLightNode.js +68 -68
  319. package/examples/jsm/nodes/lighting/SpotLightNode.js +89 -89
  320. package/examples/jsm/nodes/loaders/NodeLoader.js +108 -108
  321. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +59 -59
  322. package/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -70
  323. package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -162
  324. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +436 -436
  325. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +28 -28
  326. package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -54
  327. package/examples/jsm/nodes/materials/Materials.js +16 -16
  328. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +28 -28
  329. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -34
  330. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +40 -40
  331. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +65 -65
  332. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +155 -155
  333. package/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -84
  334. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +80 -80
  335. package/examples/jsm/nodes/materials/NodeMaterial.js +601 -568
  336. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +39 -39
  337. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +90 -96
  338. package/examples/jsm/nodes/materialx/DISCLAIMER.md +199 -199
  339. package/examples/jsm/nodes/materialx/MaterialXNodes.js +68 -68
  340. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +130 -130
  341. package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -1430
  342. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +29 -29
  343. package/examples/jsm/nodes/math/CondNode.js +121 -86
  344. package/examples/jsm/nodes/math/HashNode.js +34 -34
  345. package/examples/jsm/nodes/math/MathNode.js +391 -382
  346. package/examples/jsm/nodes/math/MathUtils.js +15 -0
  347. package/examples/jsm/nodes/math/OperatorNode.js +274 -266
  348. package/examples/jsm/nodes/math/TriNoise3D.js +71 -71
  349. package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +152 -152
  350. package/examples/jsm/nodes/parsers/GLSLNodeParser.js +14 -14
  351. package/examples/jsm/nodes/procedural/CheckerNode.js +42 -42
  352. package/examples/jsm/nodes/shadernode/ShaderNode.js +634 -625
  353. package/examples/jsm/nodes/utils/ArrayElementNode.js +35 -41
  354. package/examples/jsm/nodes/utils/ConvertNode.js +65 -65
  355. package/examples/jsm/nodes/utils/DiscardNode.js +27 -27
  356. package/examples/jsm/nodes/utils/EquirectUVNode.js +33 -33
  357. package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -95
  358. package/examples/jsm/nodes/utils/JoinNode.js +61 -61
  359. package/examples/jsm/nodes/utils/LoopNode.js +200 -198
  360. package/examples/jsm/nodes/utils/MatcapUVNode.js +30 -30
  361. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +46 -46
  362. package/examples/jsm/nodes/utils/OscNode.js +81 -81
  363. package/examples/jsm/nodes/utils/PackingNode.js +55 -55
  364. package/examples/jsm/nodes/utils/ReflectorNode.js +227 -0
  365. package/examples/jsm/nodes/utils/RemapNode.js +42 -42
  366. package/examples/jsm/nodes/utils/RotateNode.js +68 -43
  367. package/examples/jsm/nodes/utils/RotateUVNode.js +35 -43
  368. package/examples/jsm/nodes/utils/SetNode.js +62 -62
  369. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -37
  370. package/examples/jsm/nodes/utils/SplitNode.js +112 -112
  371. package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +41 -41
  372. package/examples/jsm/nodes/utils/StorageArrayElementNode.js +91 -0
  373. package/examples/jsm/nodes/utils/TimerNode.js +94 -94
  374. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +62 -62
  375. package/examples/jsm/objects/GroundedSkybox.js +50 -50
  376. package/examples/jsm/objects/InstancedPoints.js +21 -21
  377. package/examples/jsm/objects/Lensflare.js +397 -397
  378. package/examples/jsm/objects/MarchingCubes.js +1176 -1176
  379. package/examples/jsm/objects/QuadMesh.js +66 -66
  380. package/examples/jsm/objects/Reflector.js +264 -264
  381. package/examples/jsm/objects/ReflectorForSSRPass.js +352 -352
  382. package/examples/jsm/objects/Refractor.js +327 -327
  383. package/examples/jsm/objects/ShadowMesh.js +80 -80
  384. package/examples/jsm/objects/Sky.js +219 -219
  385. package/examples/jsm/objects/Water.js +333 -333
  386. package/examples/jsm/objects/Water2.js +361 -361
  387. package/examples/jsm/offscreen/jank.js +45 -45
  388. package/examples/jsm/offscreen/offscreen.js +8 -8
  389. package/examples/jsm/offscreen/scene.js +86 -86
  390. package/examples/jsm/physics/AmmoPhysics.js +306 -306
  391. package/examples/jsm/physics/RapierPhysics.js +220 -220
  392. package/examples/jsm/postprocessing/AfterimagePass.js +104 -104
  393. package/examples/jsm/postprocessing/BloomPass.js +172 -172
  394. package/examples/jsm/postprocessing/BokehPass.js +141 -141
  395. package/examples/jsm/postprocessing/ClearPass.js +46 -46
  396. package/examples/jsm/postprocessing/CubeTexturePass.js +85 -85
  397. package/examples/jsm/postprocessing/DotScreenPass.js +65 -65
  398. package/examples/jsm/postprocessing/EffectComposer.js +231 -231
  399. package/examples/jsm/postprocessing/FilmPass.js +64 -64
  400. package/examples/jsm/postprocessing/GTAOPass.js +582 -582
  401. package/examples/jsm/postprocessing/GlitchPass.js +128 -128
  402. package/examples/jsm/postprocessing/HalftonePass.js +79 -79
  403. package/examples/jsm/postprocessing/LUTPass.js +174 -174
  404. package/examples/jsm/postprocessing/MaskPass.js +104 -104
  405. package/examples/jsm/postprocessing/OutlinePass.js +654 -654
  406. package/examples/jsm/postprocessing/OutputPass.js +97 -95
  407. package/examples/jsm/postprocessing/Pass.js +95 -95
  408. package/examples/jsm/postprocessing/RenderPass.js +99 -99
  409. package/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -235
  410. package/examples/jsm/postprocessing/SAOPass.js +335 -335
  411. package/examples/jsm/postprocessing/SMAAPass.js +199 -199
  412. package/examples/jsm/postprocessing/SSAARenderPass.js +228 -228
  413. package/examples/jsm/postprocessing/SSAOPass.js +420 -420
  414. package/examples/jsm/postprocessing/SSRPass.js +641 -641
  415. package/examples/jsm/postprocessing/SavePass.js +79 -79
  416. package/examples/jsm/postprocessing/ShaderPass.js +77 -77
  417. package/examples/jsm/postprocessing/TAARenderPass.js +188 -188
  418. package/examples/jsm/postprocessing/TexturePass.js +67 -67
  419. package/examples/jsm/postprocessing/UnrealBloomPass.js +415 -415
  420. package/examples/jsm/renderers/CSS2DRenderer.js +215 -215
  421. package/examples/jsm/renderers/CSS3DRenderer.js +329 -329
  422. package/examples/jsm/renderers/Projector.js +918 -918
  423. package/examples/jsm/renderers/SVGRenderer.js +556 -556
  424. package/examples/jsm/renderers/common/Animation.js +47 -47
  425. package/examples/jsm/renderers/common/Attributes.js +75 -75
  426. package/examples/jsm/renderers/common/Backend.js +195 -193
  427. package/examples/jsm/renderers/common/Background.js +134 -134
  428. package/examples/jsm/renderers/common/Binding.js +25 -25
  429. package/examples/jsm/renderers/common/Bindings.js +173 -173
  430. package/examples/jsm/renderers/common/Buffer.js +38 -38
  431. package/examples/jsm/renderers/common/BufferUtils.js +33 -33
  432. package/examples/jsm/renderers/common/ChainMap.js +89 -89
  433. package/examples/jsm/renderers/common/ClippingContext.js +165 -0
  434. package/examples/jsm/renderers/common/Color4.js +37 -37
  435. package/examples/jsm/renderers/common/ComputePipeline.js +17 -17
  436. package/examples/jsm/renderers/common/Constants.js +14 -14
  437. package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -65
  438. package/examples/jsm/renderers/common/DataMap.js +54 -54
  439. package/examples/jsm/renderers/common/Geometries.js +215 -215
  440. package/examples/jsm/renderers/common/Info.js +107 -107
  441. package/examples/jsm/renderers/common/Pipeline.js +13 -13
  442. package/examples/jsm/renderers/common/Pipelines.js +322 -322
  443. package/examples/jsm/renderers/common/PostProcessing.js +25 -25
  444. package/examples/jsm/renderers/common/ProgrammableStage.js +20 -20
  445. package/examples/jsm/renderers/common/RenderContext.js +43 -41
  446. package/examples/jsm/renderers/common/RenderContexts.js +63 -74
  447. package/examples/jsm/renderers/common/RenderList.js +186 -186
  448. package/examples/jsm/renderers/common/RenderLists.js +38 -38
  449. package/examples/jsm/renderers/common/RenderObject.js +221 -178
  450. package/examples/jsm/renderers/common/RenderObjects.js +93 -91
  451. package/examples/jsm/renderers/common/RenderPipeline.js +16 -16
  452. package/examples/jsm/renderers/common/Renderer.js +1304 -1062
  453. package/examples/jsm/renderers/common/SampledTexture.js +83 -83
  454. package/examples/jsm/renderers/common/Sampler.js +18 -18
  455. package/examples/jsm/renderers/common/StorageBuffer.js +17 -17
  456. package/examples/jsm/renderers/common/StorageBufferAttribute.js +17 -21
  457. package/examples/jsm/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  458. package/examples/jsm/renderers/common/StorageTexture.js +20 -20
  459. package/examples/jsm/renderers/common/Textures.js +344 -354
  460. package/examples/jsm/renderers/common/Uniform.js +140 -140
  461. package/examples/jsm/renderers/common/UniformBuffer.js +15 -15
  462. package/examples/jsm/renderers/common/UniformsGroup.js +301 -299
  463. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +44 -44
  464. package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +49 -49
  465. package/examples/jsm/renderers/common/nodes/NodeSampler.js +15 -15
  466. package/examples/jsm/renderers/common/nodes/NodeStorageBuffer.js +23 -0
  467. package/examples/jsm/renderers/common/nodes/NodeUniform.js +135 -135
  468. package/examples/jsm/renderers/common/nodes/NodeUniformBuffer.js +23 -0
  469. package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -44
  470. package/examples/jsm/renderers/common/nodes/Nodes.js +496 -495
  471. package/examples/jsm/renderers/webgl/WebGLBackend.js +1382 -1290
  472. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +804 -679
  473. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +258 -252
  474. package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -36
  475. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -11
  476. package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +36 -36
  477. package/examples/jsm/renderers/webgl/utils/WebGLState.js +738 -738
  478. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +694 -647
  479. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +285 -284
  480. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +320 -320
  481. package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +26 -26
  482. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +794 -794
  483. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +51 -51
  484. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +1322 -1321
  485. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +53 -53
  486. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +1078 -1098
  487. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +104 -104
  488. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.js +14 -14
  489. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +293 -287
  490. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +244 -244
  491. package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +324 -324
  492. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +591 -570
  493. package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -285
  494. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +1040 -1040
  495. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +93 -93
  496. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +89 -89
  497. package/examples/jsm/shaders/AfterimageShader.js +58 -58
  498. package/examples/jsm/shaders/BasicShader.js +29 -29
  499. package/examples/jsm/shaders/BleachBypassShader.js +62 -62
  500. package/examples/jsm/shaders/BlendShader.js +49 -49
  501. package/examples/jsm/shaders/BokehShader.js +145 -145
  502. package/examples/jsm/shaders/BokehShader2.js +397 -397
  503. package/examples/jsm/shaders/BrightnessContrastShader.js +56 -56
  504. package/examples/jsm/shaders/ColorCorrectionShader.js +52 -52
  505. package/examples/jsm/shaders/ColorifyShader.js +51 -51
  506. package/examples/jsm/shaders/ConvolutionShader.js +103 -103
  507. package/examples/jsm/shaders/CopyShader.js +45 -45
  508. package/examples/jsm/shaders/DOFMipMapShader.js +56 -56
  509. package/examples/jsm/shaders/DepthLimitedBlurShader.js +171 -171
  510. package/examples/jsm/shaders/DigitalGlitch.js +101 -101
  511. package/examples/jsm/shaders/DotScreenShader.js +70 -70
  512. package/examples/jsm/shaders/ExposureShader.js +44 -44
  513. package/examples/jsm/shaders/FXAAShader.js +288 -288
  514. package/examples/jsm/shaders/FilmShader.js +59 -59
  515. package/examples/jsm/shaders/FocusShader.js +89 -89
  516. package/examples/jsm/shaders/FreiChenShader.js +96 -96
  517. package/examples/jsm/shaders/GTAOShader.js +424 -424
  518. package/examples/jsm/shaders/GammaCorrectionShader.js +43 -43
  519. package/examples/jsm/shaders/GodRaysShader.js +321 -321
  520. package/examples/jsm/shaders/HalftoneShader.js +312 -312
  521. package/examples/jsm/shaders/HorizontalBlurShader.js +59 -59
  522. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +63 -63
  523. package/examples/jsm/shaders/HueSaturationShader.js +67 -67
  524. package/examples/jsm/shaders/KaleidoShader.js +58 -58
  525. package/examples/jsm/shaders/LuminosityHighPassShader.js +66 -66
  526. package/examples/jsm/shaders/LuminosityShader.js +48 -48
  527. package/examples/jsm/shaders/MMDToonShader.js +134 -134
  528. package/examples/jsm/shaders/MirrorShader.js +56 -56
  529. package/examples/jsm/shaders/NormalMapShader.js +55 -55
  530. package/examples/jsm/shaders/OutputShader.js +85 -81
  531. package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -226
  532. package/examples/jsm/shaders/RGBShiftShader.js +54 -54
  533. package/examples/jsm/shaders/SAOShader.js +179 -179
  534. package/examples/jsm/shaders/SMAAShader.js +466 -466
  535. package/examples/jsm/shaders/SSAOShader.js +300 -300
  536. package/examples/jsm/shaders/SSRShader.js +370 -370
  537. package/examples/jsm/shaders/SepiaShader.js +52 -52
  538. package/examples/jsm/shaders/SobelOperatorShader.js +92 -92
  539. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +90 -90
  540. package/examples/jsm/shaders/TechnicolorShader.js +45 -45
  541. package/examples/jsm/shaders/ToonShader.js +326 -326
  542. package/examples/jsm/shaders/TriangleBlurShader.js +74 -74
  543. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +47 -47
  544. package/examples/jsm/shaders/VelocityShader.js +130 -130
  545. package/examples/jsm/shaders/VerticalBlurShader.js +59 -59
  546. package/examples/jsm/shaders/VerticalTiltShiftShader.js +63 -63
  547. package/examples/jsm/shaders/VignetteShader.js +51 -51
  548. package/examples/jsm/shaders/VolumeShader.js +289 -289
  549. package/examples/jsm/shaders/WaterRefractionShader.js +95 -95
  550. package/examples/jsm/textures/FlakesTexture.js +40 -40
  551. package/examples/jsm/transpiler/AST.js +270 -270
  552. package/examples/jsm/transpiler/GLSLDecoder.js +941 -941
  553. package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -49
  554. package/examples/jsm/transpiler/TSLEncoder.js +715 -715
  555. package/examples/jsm/transpiler/Transpiler.js +18 -18
  556. package/examples/jsm/utils/BufferGeometryUtils.js +1371 -1371
  557. package/examples/jsm/utils/CameraUtils.js +73 -73
  558. package/examples/jsm/utils/GPUStatsPanel.js +128 -128
  559. package/examples/jsm/utils/GeometryCompressionUtils.js +639 -639
  560. package/examples/jsm/utils/GeometryUtils.js +221 -221
  561. package/examples/jsm/utils/LDrawUtils.js +202 -202
  562. package/examples/jsm/utils/PackedPhongMaterial.js +178 -178
  563. package/examples/jsm/utils/SceneUtils.js +254 -254
  564. package/examples/jsm/utils/ShadowMapViewer.js +210 -210
  565. package/examples/jsm/utils/SkeletonUtils.js +424 -413
  566. package/examples/jsm/utils/SortUtils.js +160 -160
  567. package/examples/jsm/utils/TextureUtils.js +98 -98
  568. package/examples/jsm/utils/UVsDebug.js +165 -165
  569. package/examples/jsm/utils/WorkerPool.js +102 -102
  570. package/examples/jsm/webxr/ARButton.js +232 -232
  571. package/examples/jsm/webxr/OculusHandModel.js +109 -109
  572. package/examples/jsm/webxr/OculusHandPointerModel.js +416 -416
  573. package/examples/jsm/webxr/Text2D.js +38 -38
  574. package/examples/jsm/webxr/VRButton.js +233 -225
  575. package/examples/jsm/webxr/XRButton.js +223 -224
  576. package/examples/jsm/webxr/XRControllerModelFactory.js +323 -315
  577. package/examples/jsm/webxr/XREstimatedLight.js +223 -223
  578. package/examples/jsm/webxr/XRHandMeshModel.js +116 -116
  579. package/examples/jsm/webxr/XRHandModelFactory.js +105 -105
  580. package/examples/jsm/webxr/XRHandPrimitiveModel.js +105 -105
  581. package/examples/jsm/webxr/XRPlanes.js +100 -100
  582. package/package.json +4 -4
  583. package/src/Three.Legacy.js +21 -1
  584. package/src/Three.js +183 -184
  585. package/src/animation/AnimationAction.js +700 -700
  586. package/src/animation/AnimationClip.js +473 -473
  587. package/src/animation/AnimationMixer.js +770 -770
  588. package/src/animation/AnimationObjectGroup.js +387 -387
  589. package/src/animation/AnimationUtils.js +356 -356
  590. package/src/animation/KeyframeTrack.js +462 -462
  591. package/src/animation/PropertyBinding.js +719 -719
  592. package/src/animation/PropertyMixer.js +318 -318
  593. package/src/animation/tracks/BooleanKeyframeTrack.js +19 -19
  594. package/src/animation/tracks/ColorKeyframeTrack.js +15 -15
  595. package/src/animation/tracks/NumberKeyframeTrack.js +12 -12
  596. package/src/animation/tracks/QuaternionKeyframeTrack.js +23 -23
  597. package/src/animation/tracks/StringKeyframeTrack.js +15 -15
  598. package/src/animation/tracks/VectorKeyframeTrack.js +12 -12
  599. package/src/audio/Audio.js +400 -400
  600. package/src/audio/AudioAnalyser.js +40 -40
  601. package/src/audio/AudioContext.js +25 -25
  602. package/src/audio/AudioListener.js +140 -140
  603. package/src/audio/PositionalAudio.js +146 -146
  604. package/src/cameras/ArrayCamera.js +17 -17
  605. package/src/cameras/Camera.js +69 -69
  606. package/src/cameras/CubeCamera.js +173 -173
  607. package/src/cameras/OrthographicCamera.js +136 -136
  608. package/src/cameras/PerspectiveCamera.js +268 -268
  609. package/src/cameras/StereoCamera.js +100 -100
  610. package/src/constants.js +217 -216
  611. package/src/core/BufferAttribute.js +639 -650
  612. package/src/core/BufferGeometry.js +1073 -1079
  613. package/src/core/Clock.js +74 -74
  614. package/src/core/EventDispatcher.js +87 -87
  615. package/src/core/GLBufferAttribute.js +60 -60
  616. package/src/core/InstancedBufferAttribute.js +39 -39
  617. package/src/core/InstancedBufferGeometry.js +40 -40
  618. package/src/core/InstancedInterleavedBuffer.js +48 -48
  619. package/src/core/InterleavedBuffer.js +166 -166
  620. package/src/core/InterleavedBufferAttribute.js +351 -351
  621. package/src/core/Layers.js +60 -60
  622. package/src/core/Object3D.js +1019 -1008
  623. package/src/core/Raycaster.js +124 -110
  624. package/src/core/RenderTarget.js +154 -131
  625. package/src/core/Uniform.js +17 -17
  626. package/src/core/UniformsGroup.js +98 -98
  627. package/src/extras/DataUtils.js +176 -176
  628. package/src/extras/Earcut.js +789 -789
  629. package/src/extras/ImageUtils.js +129 -129
  630. package/src/extras/PMREMGenerator.js +912 -910
  631. package/src/extras/ShapeUtils.js +92 -92
  632. package/src/extras/core/Curve.js +416 -416
  633. package/src/extras/core/CurvePath.js +255 -255
  634. package/src/extras/core/Interpolations.js +79 -79
  635. package/src/extras/core/Path.js +196 -196
  636. package/src/extras/core/Shape.js +102 -102
  637. package/src/extras/core/ShapePath.js +291 -291
  638. package/src/extras/curves/ArcCurve.js +17 -17
  639. package/src/extras/curves/CatmullRomCurve3.js +255 -255
  640. package/src/extras/curves/CubicBezierCurve.js +78 -78
  641. package/src/extras/curves/CubicBezierCurve3.js +79 -79
  642. package/src/extras/curves/Curves.js +10 -10
  643. package/src/extras/curves/EllipseCurve.js +156 -156
  644. package/src/extras/curves/LineCurve.js +92 -92
  645. package/src/extras/curves/LineCurve3.js +92 -92
  646. package/src/extras/curves/QuadraticBezierCurve.js +74 -74
  647. package/src/extras/curves/QuadraticBezierCurve3.js +75 -75
  648. package/src/extras/curves/SplineCurve.js +97 -97
  649. package/src/geometries/BoxGeometry.js +180 -180
  650. package/src/geometries/CapsuleGeometry.js +33 -33
  651. package/src/geometries/CircleGeometry.js +101 -101
  652. package/src/geometries/ConeGeometry.js +31 -31
  653. package/src/geometries/CylinderGeometry.js +286 -286
  654. package/src/geometries/DodecahedronGeometry.js +66 -66
  655. package/src/geometries/EdgesGeometry.js +152 -152
  656. package/src/geometries/ExtrudeGeometry.js +814 -814
  657. package/src/geometries/Geometries.js +21 -21
  658. package/src/geometries/IcosahedronGeometry.js +42 -42
  659. package/src/geometries/LatheGeometry.js +189 -189
  660. package/src/geometries/OctahedronGeometry.js +37 -37
  661. package/src/geometries/PlaneGeometry.js +98 -98
  662. package/src/geometries/PolyhedronGeometry.js +319 -319
  663. package/src/geometries/RingGeometry.js +128 -128
  664. package/src/geometries/ShapeGeometry.js +195 -195
  665. package/src/geometries/SphereGeometry.js +137 -137
  666. package/src/geometries/TetrahedronGeometry.js +34 -34
  667. package/src/geometries/TorusGeometry.js +120 -120
  668. package/src/geometries/TorusKnotGeometry.js +167 -167
  669. package/src/geometries/TubeGeometry.js +203 -203
  670. package/src/geometries/WireframeGeometry.js +147 -147
  671. package/src/helpers/ArrowHelper.js +114 -114
  672. package/src/helpers/AxesHelper.js +68 -68
  673. package/src/helpers/Box3Helper.js +55 -55
  674. package/src/helpers/BoxHelper.js +113 -113
  675. package/src/helpers/CameraHelper.js +269 -269
  676. package/src/helpers/DirectionalLightHelper.js +93 -93
  677. package/src/helpers/GridHelper.js +56 -56
  678. package/src/helpers/HemisphereLightHelper.js +88 -88
  679. package/src/helpers/PlaneHelper.js +63 -63
  680. package/src/helpers/PointLightHelper.js +92 -92
  681. package/src/helpers/PolarGridHelper.js +96 -96
  682. package/src/helpers/SkeletonHelper.js +128 -128
  683. package/src/helpers/SpotLightHelper.js +111 -94
  684. package/src/lights/AmbientLight.js +17 -17
  685. package/src/lights/DirectionalLight.js +43 -43
  686. package/src/lights/DirectionalLightShadow.js +16 -16
  687. package/src/lights/HemisphereLight.js +34 -34
  688. package/src/lights/Light.js +58 -58
  689. package/src/lights/LightProbe.js +47 -47
  690. package/src/lights/LightShadow.js +147 -147
  691. package/src/lights/PointLight.js +57 -57
  692. package/src/lights/PointLightShadow.js +96 -96
  693. package/src/lights/RectAreaLight.js +56 -56
  694. package/src/lights/SpotLight.js +71 -71
  695. package/src/lights/SpotLightShadow.js +50 -50
  696. package/src/loaders/AnimationLoader.js +66 -66
  697. package/src/loaders/AudioLoader.js +66 -66
  698. package/src/loaders/BufferGeometryLoader.js +217 -217
  699. package/src/loaders/Cache.js +42 -42
  700. package/src/loaders/CompressedTextureLoader.js +134 -134
  701. package/src/loaders/CubeTextureLoader.js +58 -58
  702. package/src/loaders/DataTextureLoader.js +131 -135
  703. package/src/loaders/FileLoader.js +284 -284
  704. package/src/loaders/ImageBitmapLoader.js +123 -123
  705. package/src/loaders/ImageLoader.js +91 -91
  706. package/src/loaders/Loader.js +72 -72
  707. package/src/loaders/LoaderUtils.js +75 -75
  708. package/src/loaders/LoadingManager.js +142 -142
  709. package/src/loaders/MaterialLoader.js +373 -372
  710. package/src/loaders/ObjectLoader.js +1149 -1148
  711. package/src/loaders/TextureLoader.js +41 -41
  712. package/src/materials/LineBasicMaterial.js +49 -53
  713. package/src/materials/LineDashedMaterial.js +35 -35
  714. package/src/materials/Material.js +523 -522
  715. package/src/materials/Materials.js +39 -39
  716. package/src/materials/MeshBasicMaterial.js +84 -85
  717. package/src/materials/MeshDepthMaterial.js +54 -54
  718. package/src/materials/MeshDistanceMaterial.js +43 -43
  719. package/src/materials/MeshLambertMaterial.js +119 -120
  720. package/src/materials/MeshMatcapMaterial.js +81 -85
  721. package/src/materials/MeshNormalMaterial.js +61 -61
  722. package/src/materials/MeshPhongMaterial.js +123 -124
  723. package/src/materials/MeshPhysicalMaterial.js +224 -224
  724. package/src/materials/MeshStandardMaterial.js +127 -128
  725. package/src/materials/MeshToonMaterial.js +102 -106
  726. package/src/materials/PointsMaterial.js +50 -54
  727. package/src/materials/RawShaderMaterial.js +17 -17
  728. package/src/materials/ShaderMaterial.js +189 -190
  729. package/src/materials/ShadowMaterial.js +37 -37
  730. package/src/materials/SpriteMaterial.js +54 -54
  731. package/src/math/Box2.js +204 -204
  732. package/src/math/Box3.js +534 -534
  733. package/src/math/Color.js +623 -623
  734. package/src/math/ColorManagement.js +139 -139
  735. package/src/math/Cylindrical.js +61 -61
  736. package/src/math/Euler.js +315 -315
  737. package/src/math/Frustum.js +186 -186
  738. package/src/math/Interpolant.js +241 -241
  739. package/src/math/Line3.js +115 -115
  740. package/src/math/MathUtils.js +363 -363
  741. package/src/math/Matrix3.js +388 -388
  742. package/src/math/Matrix4.js +915 -915
  743. package/src/math/Plane.js +205 -205
  744. package/src/math/Quaternion.js +686 -685
  745. package/src/math/Ray.js +493 -493
  746. package/src/math/Sphere.js +245 -245
  747. package/src/math/Spherical.js +86 -86
  748. package/src/math/SphericalHarmonics3.js +243 -243
  749. package/src/math/Triangle.js +311 -311
  750. package/src/math/Vector2.js +480 -480
  751. package/src/math/Vector3.js +724 -724
  752. package/src/math/Vector4.js +644 -644
  753. package/src/math/interpolants/CubicInterpolant.js +150 -150
  754. package/src/math/interpolants/DiscreteInterpolant.js +26 -26
  755. package/src/math/interpolants/LinearInterpolant.js +38 -38
  756. package/src/math/interpolants/QuaternionLinearInterpolant.js +39 -39
  757. package/src/objects/BatchedMesh.js +1019 -1019
  758. package/src/objects/Bone.js +17 -17
  759. package/src/objects/Group.js +17 -17
  760. package/src/objects/InstancedMesh.js +267 -214
  761. package/src/objects/LOD.js +214 -214
  762. package/src/objects/Line.js +222 -222
  763. package/src/objects/LineLoop.js +17 -17
  764. package/src/objects/LineSegments.js +55 -55
  765. package/src/objects/Mesh.js +428 -429
  766. package/src/objects/Points.js +166 -166
  767. package/src/objects/Skeleton.js +277 -277
  768. package/src/objects/SkinnedMesh.js +257 -257
  769. package/src/objects/Sprite.js +181 -181
  770. package/src/renderers/WebGL1Renderer.js +7 -7
  771. package/src/renderers/WebGL3DRenderTarget.js +22 -22
  772. package/src/renderers/WebGLArrayRenderTarget.js +22 -22
  773. package/src/renderers/WebGLCubeRenderTarget.js +146 -155
  774. package/src/renderers/WebGLRenderTarget.js +15 -15
  775. package/src/renderers/WebGLRenderer.js +2615 -2631
  776. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -7
  777. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -68
  778. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -7
  779. package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -7
  780. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -16
  781. package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -5
  782. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -26
  783. package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -8
  784. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -19
  785. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -5
  786. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -9
  787. package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -9
  788. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -33
  789. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -43
  790. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -7
  791. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -10
  792. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -21
  793. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -78
  794. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -9
  795. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -7
  796. package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -7
  797. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +11 -11
  798. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +11 -11
  799. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +11 -11
  800. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +23 -23
  801. package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -3
  802. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +44 -44
  803. package/src/renderers/shaders/ShaderChunk/common.glsl.js +147 -147
  804. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -186
  805. package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -5
  806. package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -5
  807. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -63
  808. package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -9
  809. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -7
  810. package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -7
  811. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -20
  812. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +9 -9
  813. package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -7
  814. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +15 -14
  815. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +62 -62
  816. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -21
  817. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -22
  818. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -69
  819. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -37
  820. package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -17
  821. package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -19
  822. package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -7
  823. package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -7
  824. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -27
  825. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -120
  826. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -14
  827. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +10 -10
  828. package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -8
  829. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +202 -202
  830. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +13 -13
  831. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +40 -40
  832. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -5
  833. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -28
  834. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +228 -228
  835. package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -7
  836. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -32
  837. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +151 -151
  838. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +562 -562
  839. package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -4
  840. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -26
  841. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -9
  842. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -9
  843. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +16 -16
  844. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +22 -22
  845. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +21 -21
  846. package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +11 -11
  847. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -27
  848. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -27
  849. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -12
  850. package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -7
  851. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -24
  852. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  853. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +27 -27
  854. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +47 -38
  855. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +36 -36
  856. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -76
  857. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +33 -33
  858. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -14
  859. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -14
  860. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -14
  861. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -43
  862. package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -11
  863. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +68 -68
  864. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +8 -8
  865. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -19
  866. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -12
  867. package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -7
  868. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +314 -314
  869. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +68 -68
  870. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +68 -68
  871. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -66
  872. package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -10
  873. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -25
  874. package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -15
  875. package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -20
  876. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -14
  877. package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -7
  878. package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -7
  879. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +192 -169
  880. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -36
  881. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +201 -201
  882. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -119
  883. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -145
  884. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -122
  885. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -21
  886. package/src/renderers/shaders/ShaderChunk.js +272 -274
  887. package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -40
  888. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +63 -62
  889. package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -36
  890. package/src/renderers/shaders/ShaderLib/depth.glsl.js +97 -95
  891. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +78 -76
  892. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -35
  893. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -77
  894. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -117
  895. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +125 -126
  896. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -113
  897. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +87 -89
  898. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +127 -128
  899. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +225 -226
  900. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +119 -120
  901. package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -88
  902. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -57
  903. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +81 -81
  904. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +53 -53
  905. package/src/renderers/shaders/ShaderLib.js +360 -367
  906. package/src/renderers/shaders/UniformsLib.js +231 -236
  907. package/src/renderers/shaders/UniformsUtils.js +104 -104
  908. package/src/renderers/webgl/WebGLAnimation.js +53 -53
  909. package/src/renderers/webgl/WebGLAttributes.js +229 -229
  910. package/src/renderers/webgl/WebGLBackground.js +257 -239
  911. package/src/renderers/webgl/WebGLBindingStates.js +631 -631
  912. package/src/renderers/webgl/WebGLBufferRenderer.js +92 -92
  913. package/src/renderers/webgl/WebGLCapabilities.js +120 -120
  914. package/src/renderers/webgl/WebGLClipping.js +171 -171
  915. package/src/renderers/webgl/WebGLCubeMaps.js +99 -99
  916. package/src/renderers/webgl/WebGLCubeUVMaps.js +132 -132
  917. package/src/renderers/webgl/WebGLExtensions.js +97 -97
  918. package/src/renderers/webgl/WebGLGeometries.js +211 -211
  919. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +102 -102
  920. package/src/renderers/webgl/WebGLInfo.js +71 -71
  921. package/src/renderers/webgl/WebGLLights.js +590 -590
  922. package/src/renderers/webgl/WebGLMaterials.js +590 -576
  923. package/src/renderers/webgl/WebGLMorphtargets.js +307 -300
  924. package/src/renderers/webgl/WebGLObjects.js +92 -92
  925. package/src/renderers/webgl/WebGLProgram.js +1120 -1112
  926. package/src/renderers/webgl/WebGLPrograms.js +664 -663
  927. package/src/renderers/webgl/WebGLProperties.js +48 -48
  928. package/src/renderers/webgl/WebGLRenderLists.js +238 -238
  929. package/src/renderers/webgl/WebGLRenderStates.js +107 -107
  930. package/src/renderers/webgl/WebGLShader.js +12 -12
  931. package/src/renderers/webgl/WebGLShaderCache.js +124 -124
  932. package/src/renderers/webgl/WebGLShadowMap.js +424 -424
  933. package/src/renderers/webgl/WebGLState.js +1318 -1328
  934. package/src/renderers/webgl/WebGLTextures.js +2213 -2117
  935. package/src/renderers/webgl/WebGLUniforms.js +1156 -1156
  936. package/src/renderers/webgl/WebGLUniformsGroups.js +392 -392
  937. package/src/renderers/webgl/WebGLUtils.js +283 -283
  938. package/src/renderers/webxr/WebXRController.js +343 -343
  939. package/src/renderers/webxr/WebXRDepthSensing.js +105 -0
  940. package/src/renderers/webxr/WebXRManager.js +824 -840
  941. package/src/scenes/Fog.js +38 -38
  942. package/src/scenes/FogExp2.js +35 -35
  943. package/src/scenes/Scene.js +71 -63
  944. package/src/textures/CanvasTexture.js +17 -17
  945. package/src/textures/CompressedArrayTexture.js +18 -18
  946. package/src/textures/CompressedCubeTexture.js +19 -19
  947. package/src/textures/CompressedTexture.js +28 -28
  948. package/src/textures/CubeTexture.js +33 -33
  949. package/src/textures/Data3DTexture.js +35 -35
  950. package/src/textures/DataArrayTexture.js +27 -27
  951. package/src/textures/DataTexture.js +22 -22
  952. package/src/textures/DepthTexture.js +58 -58
  953. package/src/textures/FramebufferTexture.js +23 -23
  954. package/src/textures/Source.js +128 -127
  955. package/src/textures/Texture.js +310 -338
  956. package/src/textures/VideoTexture.js +55 -55
  957. package/src/utils.js +91 -91
  958. package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
  959. package/src/renderers/WebGLMultipleRenderTargets.js +0 -82
  960. package/src/renderers/shaders/ShaderChunk/occlusion_fragment.glsl.js +0 -20
  961. package/src/renderers/shaders/ShaderChunk/occlusion_pars_fragment.glsl.js +0 -97
@@ -1,1124 +1,1124 @@
1
- import {
2
- AdditiveBlending,
3
- BufferGeometry,
4
- Color,
5
- DoubleSide,
6
- FileLoader,
7
- Float32BufferAttribute,
8
- Group,
9
- Loader,
10
- LoaderUtils,
11
- Matrix4,
12
- Mesh,
13
- MeshPhongMaterial,
14
- TextureLoader
15
- } from 'three';
16
-
17
- /**
18
- * Autodesk 3DS three.js file loader, based on lib3ds.
19
- *
20
- * Loads geometry with uv and materials basic properties with texture support.
21
- *
22
- * @class TDSLoader
23
- * @constructor
24
- */
25
-
26
- class TDSLoader extends Loader {
27
-
28
- constructor( manager ) {
29
-
30
- super( manager );
31
-
32
- this.debug = false;
33
-
34
- this.group = null;
35
-
36
- this.materials = [];
37
- this.meshes = [];
38
-
39
- }
40
-
41
- /**
42
- * Load 3ds file from url.
43
- *
44
- * @method load
45
- * @param {[type]} url URL for the file.
46
- * @param {Function} onLoad onLoad callback, receives group Object3D as argument.
47
- * @param {Function} onProgress onProgress callback.
48
- * @param {Function} onError onError callback.
49
- */
50
- load( url, onLoad, onProgress, onError ) {
51
-
52
- const scope = this;
53
-
54
- const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;
55
-
56
- const loader = new FileLoader( this.manager );
57
- loader.setPath( this.path );
58
- loader.setResponseType( 'arraybuffer' );
59
- loader.setRequestHeader( this.requestHeader );
60
- loader.setWithCredentials( this.withCredentials );
61
-
62
- loader.load( url, function ( data ) {
63
-
64
- try {
65
-
66
- onLoad( scope.parse( data, path ) );
67
-
68
- } catch ( e ) {
69
-
70
- if ( onError ) {
71
-
72
- onError( e );
73
-
74
- } else {
75
-
76
- console.error( e );
77
-
78
- }
79
-
80
- scope.manager.itemError( url );
81
-
82
- }
83
-
84
- }, onProgress, onError );
85
-
86
- }
87
-
88
- /**
89
- * Parse arraybuffer data and load 3ds file.
90
- *
91
- * @method parse
92
- * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
93
- * @param {String} path Path for external resources.
94
- * @return {Group} Group loaded from 3ds file.
95
- */
96
- parse( arraybuffer, path ) {
97
-
98
- this.group = new Group();
99
- this.materials = [];
100
- this.meshes = [];
101
-
102
- this.readFile( arraybuffer, path );
103
-
104
- for ( let i = 0; i < this.meshes.length; i ++ ) {
105
-
106
- this.group.add( this.meshes[ i ] );
107
-
108
- }
109
-
110
- return this.group;
111
-
112
- }
113
-
114
- /**
115
- * Decode file content to read 3ds data.
116
- *
117
- * @method readFile
118
- * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
119
- * @param {String} path Path for external resources.
120
- */
121
- readFile( arraybuffer, path ) {
122
-
123
- const data = new DataView( arraybuffer );
124
- const chunk = new Chunk( data, 0, this.debugMessage );
125
-
126
- if ( chunk.id === MLIBMAGIC || chunk.id === CMAGIC || chunk.id === M3DMAGIC ) {
127
-
128
- let next = chunk.readChunk();
129
-
130
- while ( next ) {
131
-
132
- if ( next.id === M3D_VERSION ) {
133
-
134
- const version = next.readDWord();
135
- this.debugMessage( '3DS file version: ' + version );
136
-
137
- } else if ( next.id === MDATA ) {
138
-
139
- this.readMeshData( next, path );
140
-
141
- } else {
142
-
143
- this.debugMessage( 'Unknown main chunk: ' + next.hexId );
144
-
145
- }
146
-
147
- next = chunk.readChunk();
148
-
149
- }
150
-
151
- }
152
-
153
- this.debugMessage( 'Parsed ' + this.meshes.length + ' meshes' );
154
-
155
- }
156
-
157
- /**
158
- * Read mesh data chunk.
159
- *
160
- * @method readMeshData
161
- * @param {Chunk} chunk to read mesh from
162
- * @param {String} path Path for external resources.
163
- */
164
- readMeshData( chunk, path ) {
165
-
166
- let next = chunk.readChunk();
167
-
168
- while ( next ) {
169
-
170
- if ( next.id === MESH_VERSION ) {
171
-
172
- const version = + next.readDWord();
173
- this.debugMessage( 'Mesh Version: ' + version );
174
-
175
- } else if ( next.id === MASTER_SCALE ) {
176
-
177
- const scale = next.readFloat();
178
- this.debugMessage( 'Master scale: ' + scale );
179
- this.group.scale.set( scale, scale, scale );
180
-
181
- } else if ( next.id === NAMED_OBJECT ) {
182
-
183
- this.debugMessage( 'Named Object' );
184
- this.readNamedObject( next );
185
-
186
- } else if ( next.id === MAT_ENTRY ) {
187
-
188
- this.debugMessage( 'Material' );
189
- this.readMaterialEntry( next, path );
190
-
191
- } else {
192
-
193
- this.debugMessage( 'Unknown MDATA chunk: ' + next.hexId );
194
-
195
- }
196
-
197
- next = chunk.readChunk();
198
-
199
- }
200
-
201
- }
202
-
203
- /**
204
- * Read named object chunk.
205
- *
206
- * @method readNamedObject
207
- * @param {Chunk} chunk Chunk in use.
208
- */
209
- readNamedObject( chunk ) {
210
-
211
- const name = chunk.readString();
212
-
213
- let next = chunk.readChunk();
214
- while ( next ) {
215
-
216
- if ( next.id === N_TRI_OBJECT ) {
217
-
218
- const mesh = this.readMesh( next );
219
- mesh.name = name;
220
- this.meshes.push( mesh );
221
-
222
- } else {
223
-
224
- this.debugMessage( 'Unknown named object chunk: ' + next.hexId );
225
-
226
- }
227
-
228
- next = chunk.readChunk( );
229
-
230
- }
231
-
232
- }
233
-
234
- /**
235
- * Read material data chunk and add it to the material list.
236
- *
237
- * @method readMaterialEntry
238
- * @param {Chunk} chunk Chunk in use.
239
- * @param {String} path Path for external resources.
240
- */
241
- readMaterialEntry( chunk, path ) {
242
-
243
- let next = chunk.readChunk();
244
- const material = new MeshPhongMaterial();
245
-
246
- while ( next ) {
247
-
248
- if ( next.id === MAT_NAME ) {
249
-
250
- material.name = next.readString();
251
- this.debugMessage( ' Name: ' + material.name );
252
-
253
- } else if ( next.id === MAT_WIRE ) {
254
-
255
- this.debugMessage( ' Wireframe' );
256
- material.wireframe = true;
257
-
258
- } else if ( next.id === MAT_WIRE_SIZE ) {
259
-
260
- const value = next.readByte();
261
- material.wireframeLinewidth = value;
262
- this.debugMessage( ' Wireframe Thickness: ' + value );
263
-
264
- } else if ( next.id === MAT_TWO_SIDE ) {
265
-
266
- material.side = DoubleSide;
267
- this.debugMessage( ' DoubleSided' );
268
-
269
- } else if ( next.id === MAT_ADDITIVE ) {
270
-
271
- this.debugMessage( ' Additive Blending' );
272
- material.blending = AdditiveBlending;
273
-
274
- } else if ( next.id === MAT_DIFFUSE ) {
275
-
276
- this.debugMessage( ' Diffuse Color' );
277
- material.color = this.readColor( next );
278
-
279
- } else if ( next.id === MAT_SPECULAR ) {
280
-
281
- this.debugMessage( ' Specular Color' );
282
- material.specular = this.readColor( next );
283
-
284
- } else if ( next.id === MAT_AMBIENT ) {
285
-
286
- this.debugMessage( ' Ambient color' );
287
- material.color = this.readColor( next );
288
-
289
- } else if ( next.id === MAT_SHININESS ) {
290
-
291
- const shininess = this.readPercentage( next );
292
- material.shininess = shininess * 100;
293
- this.debugMessage( ' Shininess : ' + shininess );
294
-
295
- } else if ( next.id === MAT_TRANSPARENCY ) {
296
-
297
- const transparency = this.readPercentage( next );
298
- material.opacity = 1 - transparency;
299
- this.debugMessage( ' Transparency : ' + transparency );
300
- material.transparent = material.opacity < 1 ? true : false;
301
-
302
- } else if ( next.id === MAT_TEXMAP ) {
303
-
304
- this.debugMessage( ' ColorMap' );
305
- material.map = this.readMap( next, path );
306
-
307
- } else if ( next.id === MAT_BUMPMAP ) {
308
-
309
- this.debugMessage( ' BumpMap' );
310
- material.bumpMap = this.readMap( next, path );
311
-
312
- } else if ( next.id === MAT_OPACMAP ) {
313
-
314
- this.debugMessage( ' OpacityMap' );
315
- material.alphaMap = this.readMap( next, path );
316
-
317
- } else if ( next.id === MAT_SPECMAP ) {
318
-
319
- this.debugMessage( ' SpecularMap' );
320
- material.specularMap = this.readMap( next, path );
321
-
322
- } else {
323
-
324
- this.debugMessage( ' Unknown material chunk: ' + next.hexId );
325
-
326
- }
327
-
328
- next = chunk.readChunk();
329
-
330
- }
331
-
332
- this.materials[ material.name ] = material;
333
-
334
- }
335
-
336
- /**
337
- * Read mesh data chunk.
338
- *
339
- * @method readMesh
340
- * @param {Chunk} chunk Chunk in use.
341
- * @return {Mesh} The parsed mesh.
342
- */
343
- readMesh( chunk ) {
344
-
345
- let next = chunk.readChunk( );
346
-
347
- const geometry = new BufferGeometry();
348
-
349
- const material = new MeshPhongMaterial();
350
- const mesh = new Mesh( geometry, material );
351
- mesh.name = 'mesh';
352
-
353
- while ( next ) {
354
-
355
- if ( next.id === POINT_ARRAY ) {
356
-
357
- const points = next.readWord( );
358
-
359
- this.debugMessage( ' Vertex: ' + points );
360
-
361
- //BufferGeometry
362
-
363
- const vertices = [];
364
-
365
- for ( let i = 0; i < points; i ++ ) {
366
-
367
- vertices.push( next.readFloat( ) );
368
- vertices.push( next.readFloat( ) );
369
- vertices.push( next.readFloat( ) );
370
-
371
- }
372
-
373
- geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
374
-
375
- } else if ( next.id === FACE_ARRAY ) {
376
-
377
- this.readFaceArray( next, mesh );
378
-
379
- } else if ( next.id === TEX_VERTS ) {
380
-
381
- const texels = next.readWord( );
382
-
383
- this.debugMessage( ' UV: ' + texels );
384
-
385
- //BufferGeometry
386
-
387
- const uvs = [];
388
-
389
- for ( let i = 0; i < texels; i ++ ) {
390
-
391
- uvs.push( next.readFloat( ) );
392
- uvs.push( next.readFloat( ) );
393
-
394
- }
395
-
396
- geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
397
-
398
-
399
- } else if ( next.id === MESH_MATRIX ) {
400
-
401
- this.debugMessage( ' Tranformation Matrix (TODO)' );
402
-
403
- const values = [];
404
- for ( let i = 0; i < 12; i ++ ) {
405
-
406
- values[ i ] = next.readFloat( );
407
-
408
- }
409
-
410
- const matrix = new Matrix4();
411
-
412
- //X Line
413
- matrix.elements[ 0 ] = values[ 0 ];
414
- matrix.elements[ 1 ] = values[ 6 ];
415
- matrix.elements[ 2 ] = values[ 3 ];
416
- matrix.elements[ 3 ] = values[ 9 ];
417
-
418
- //Y Line
419
- matrix.elements[ 4 ] = values[ 2 ];
420
- matrix.elements[ 5 ] = values[ 8 ];
421
- matrix.elements[ 6 ] = values[ 5 ];
422
- matrix.elements[ 7 ] = values[ 11 ];
423
-
424
- //Z Line
425
- matrix.elements[ 8 ] = values[ 1 ];
426
- matrix.elements[ 9 ] = values[ 7 ];
427
- matrix.elements[ 10 ] = values[ 4 ];
428
- matrix.elements[ 11 ] = values[ 10 ];
429
-
430
- //W Line
431
- matrix.elements[ 12 ] = 0;
432
- matrix.elements[ 13 ] = 0;
433
- matrix.elements[ 14 ] = 0;
434
- matrix.elements[ 15 ] = 1;
435
-
436
- matrix.transpose();
437
-
438
- const inverse = new Matrix4();
439
- inverse.copy( matrix ).invert();
440
- geometry.applyMatrix4( inverse );
441
-
442
- matrix.decompose( mesh.position, mesh.quaternion, mesh.scale );
443
-
444
- } else {
445
-
446
- this.debugMessage( ' Unknown mesh chunk: ' + next.hexId );
447
-
448
- }
449
-
450
- next = chunk.readChunk( );
451
-
452
- }
453
-
454
- geometry.computeVertexNormals();
455
-
456
- return mesh;
457
-
458
- }
459
-
460
- /**
461
- * Read face array data chunk.
462
- *
463
- * @method readFaceArray
464
- * @param {Chunk} chunk Chunk in use.
465
- * @param {Mesh} mesh Mesh to be filled with the data read.
466
- */
467
- readFaceArray( chunk, mesh ) {
468
-
469
- const faces = chunk.readWord( );
470
-
471
- this.debugMessage( ' Faces: ' + faces );
472
-
473
- const index = [];
474
-
475
- for ( let i = 0; i < faces; ++ i ) {
476
-
477
- index.push( chunk.readWord( ), chunk.readWord( ), chunk.readWord( ) );
478
-
479
- chunk.readWord( ); // visibility
480
-
481
- }
482
-
483
- mesh.geometry.setIndex( index );
484
-
485
- //The rest of the FACE_ARRAY chunk is subchunks
486
-
487
- let materialIndex = 0;
488
- let start = 0;
489
-
490
- while ( ! chunk.endOfChunk ) {
491
-
492
- const subchunk = chunk.readChunk( );
493
-
494
- if ( subchunk.id === MSH_MAT_GROUP ) {
495
-
496
- this.debugMessage( ' Material Group' );
497
-
498
- const group = this.readMaterialGroup( subchunk );
499
- const count = group.index.length * 3; // assuming successive indices
500
-
501
- mesh.geometry.addGroup( start, count, materialIndex );
502
-
503
- start += count;
504
- materialIndex ++;
505
-
506
- const material = this.materials[ group.name ];
507
-
508
- if ( Array.isArray( mesh.material ) === false ) mesh.material = [];
509
-
510
- if ( material !== undefined ) {
511
-
512
- mesh.material.push( material );
513
-
514
- }
515
-
516
- } else {
517
-
518
- this.debugMessage( ' Unknown face array chunk: ' + subchunk.hexId );
519
-
520
- }
521
-
522
- }
523
-
524
- if ( mesh.material.length === 1 ) mesh.material = mesh.material[ 0 ]; // for backwards compatibility
525
-
526
- }
527
-
528
- /**
529
- * Read texture map data chunk.
530
- *
531
- * @method readMap
532
- * @param {Chunk} chunk Chunk in use.
533
- * @param {String} path Path for external resources.
534
- * @return {Texture} Texture read from this data chunk.
535
- */
536
- readMap( chunk, path ) {
537
-
538
- let next = chunk.readChunk( );
539
- let texture = {};
540
-
541
- const loader = new TextureLoader( this.manager );
542
- loader.setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
543
-
544
- while ( next ) {
545
-
546
- if ( next.id === MAT_MAPNAME ) {
547
-
548
- const name = next.readString();
549
- texture = loader.load( name );
550
-
551
- this.debugMessage( ' File: ' + path + name );
552
-
553
- } else if ( next.id === MAT_MAP_UOFFSET ) {
554
-
555
- texture.offset.x = next.readFloat( );
556
- this.debugMessage( ' OffsetX: ' + texture.offset.x );
557
-
558
- } else if ( next.id === MAT_MAP_VOFFSET ) {
559
-
560
- texture.offset.y = next.readFloat( );
561
- this.debugMessage( ' OffsetY: ' + texture.offset.y );
562
-
563
- } else if ( next.id === MAT_MAP_USCALE ) {
564
-
565
- texture.repeat.x = next.readFloat( );
566
- this.debugMessage( ' RepeatX: ' + texture.repeat.x );
567
-
568
- } else if ( next.id === MAT_MAP_VSCALE ) {
569
-
570
- texture.repeat.y = next.readFloat( );
571
- this.debugMessage( ' RepeatY: ' + texture.repeat.y );
572
-
573
- } else {
574
-
575
- this.debugMessage( ' Unknown map chunk: ' + next.hexId );
576
-
577
- }
578
-
579
- next = chunk.readChunk( );
580
-
581
- }
582
-
583
- return texture;
584
-
585
- }
586
-
587
- /**
588
- * Read material group data chunk.
589
- *
590
- * @method readMaterialGroup
591
- * @param {Chunk} chunk Chunk in use.
592
- * @return {Object} Object with name and index of the object.
593
- */
594
- readMaterialGroup( chunk ) {
595
-
596
- const name = chunk.readString();
597
- const numFaces = chunk.readWord();
598
-
599
- this.debugMessage( ' Name: ' + name );
600
- this.debugMessage( ' Faces: ' + numFaces );
601
-
602
- const index = [];
603
- for ( let i = 0; i < numFaces; ++ i ) {
604
-
605
- index.push( chunk.readWord( ) );
606
-
607
- }
608
-
609
- return { name: name, index: index };
610
-
611
- }
612
-
613
- /**
614
- * Read a color value.
615
- *
616
- * @method readColor
617
- * @param {Chunk} chunk Chunk.
618
- * @return {Color} Color value read..
619
- */
620
- readColor( chunk ) {
621
-
622
- const subChunk = chunk.readChunk( );
623
- const color = new Color();
624
-
625
- if ( subChunk.id === COLOR_24 || subChunk.id === LIN_COLOR_24 ) {
626
-
627
- const r = subChunk.readByte( );
628
- const g = subChunk.readByte( );
629
- const b = subChunk.readByte( );
630
-
631
- color.setRGB( r / 255, g / 255, b / 255 );
632
-
633
- this.debugMessage( ' Color: ' + color.r + ', ' + color.g + ', ' + color.b );
634
-
635
- } else if ( subChunk.id === COLOR_F || subChunk.id === LIN_COLOR_F ) {
636
-
637
- const r = subChunk.readFloat( );
638
- const g = subChunk.readFloat( );
639
- const b = subChunk.readFloat( );
640
-
641
- color.setRGB( r, g, b );
642
-
643
- this.debugMessage( ' Color: ' + color.r + ', ' + color.g + ', ' + color.b );
644
-
645
- } else {
646
-
647
- this.debugMessage( ' Unknown color chunk: ' + subChunk.hexId );
648
-
649
- }
650
-
651
- return color;
652
-
653
- }
654
-
655
- /**
656
- * Read percentage value.
657
- *
658
- * @method readPercentage
659
- * @param {Chunk} chunk Chunk to read data from.
660
- * @return {Number} Data read from the dataview.
661
- */
662
- readPercentage( chunk ) {
663
-
664
- const subChunk = chunk.readChunk( );
665
-
666
- switch ( subChunk.id ) {
667
-
668
- case INT_PERCENTAGE:
669
- return ( subChunk.readShort( ) / 100 );
670
- break;
671
-
672
- case FLOAT_PERCENTAGE:
673
- return subChunk.readFloat( );
674
- break;
675
-
676
- default:
677
- this.debugMessage( ' Unknown percentage chunk: ' + subChunk.hexId );
678
- return 0;
679
-
680
- }
681
-
682
- }
683
-
684
- /**
685
- * Print debug message to the console.
686
- *
687
- * Is controlled by a flag to show or hide debug messages.
688
- *
689
- * @method debugMessage
690
- * @param {Object} message Debug message to print to the console.
691
- */
692
- debugMessage( message ) {
693
-
694
- if ( this.debug ) {
695
-
696
- console.log( message );
697
-
698
- }
699
-
700
- }
701
-
702
- }
703
-
704
-
705
- /** Read data/sub-chunks from chunk */
706
- class Chunk {
707
-
708
- /**
709
- * Create a new chunk
710
- *
711
- * @class Chunk
712
- * @param {DataView} data DataView to read from.
713
- * @param {Number} position in data.
714
- * @param {Function} debugMessage logging callback.
715
- */
716
- constructor( data, position, debugMessage ) {
717
-
718
- this.data = data;
719
- // the offset to the begin of this chunk
720
- this.offset = position;
721
- // the current reading position
722
- this.position = position;
723
- this.debugMessage = debugMessage;
724
-
725
- if ( this.debugMessage instanceof Function ) {
726
-
727
- this.debugMessage = function () {};
728
-
729
- }
730
-
731
- this.id = this.readWord();
732
- this.size = this.readDWord();
733
- this.end = this.offset + this.size;
734
-
735
- if ( this.end > data.byteLength ) {
736
-
737
- this.debugMessage( 'Bad chunk size for chunk at ' + position );
738
-
739
- }
740
-
741
- }
742
-
743
- /**
744
- * read a sub cchunk.
745
- *
746
- * @method readChunk
747
- * @return {Chunk | null} next sub chunk
748
- */
749
- readChunk() {
750
-
751
- if ( this.endOfChunk ) {
752
-
753
- return null;
754
-
755
- }
756
-
757
- try {
758
-
759
- const next = new Chunk( this.data, this.position, this.debugMessage );
760
- this.position += next.size;
761
- return next;
762
-
763
- } catch ( e ) {
764
-
765
- this.debugMessage( 'Unable to read chunk at ' + this.position );
766
- return null;
767
-
768
- }
769
-
770
- }
771
-
772
- /**
773
- * return the ID of this chunk as Hex
774
- *
775
- * @method idToString
776
- * @return {String} hex-string of id
777
- */
778
- get hexId() {
779
-
780
- return this.id.toString( 16 );
781
-
782
- }
783
-
784
- get endOfChunk() {
785
-
786
- return this.position >= this.end;
787
-
788
- }
789
-
790
- /**
791
- * Read byte value.
792
- *
793
- * @method readByte
794
- * @return {Number} Data read from the dataview.
795
- */
796
- readByte() {
797
-
798
- const v = this.data.getUint8( this.position, true );
799
- this.position += 1;
800
- return v;
801
-
802
- }
803
-
804
- /**
805
- * Read 32 bit float value.
806
- *
807
- * @method readFloat
808
- * @return {Number} Data read from the dataview.
809
- */
810
- readFloat() {
811
-
812
- try {
813
-
814
- const v = this.data.getFloat32( this.position, true );
815
- this.position += 4;
816
- return v;
817
-
818
- } catch ( e ) {
819
-
820
- this.debugMessage( e + ' ' + this.position + ' ' + this.data.byteLength );
821
- return 0;
822
-
823
- }
824
-
825
- }
826
-
827
- /**
828
- * Read 32 bit signed integer value.
829
- *
830
- * @method readInt
831
- * @return {Number} Data read from the dataview.
832
- */
833
- readInt() {
834
-
835
- const v = this.data.getInt32( this.position, true );
836
- this.position += 4;
837
- return v;
838
-
839
- }
840
-
841
- /**
842
- * Read 16 bit signed integer value.
843
- *
844
- * @method readShort
845
- * @return {Number} Data read from the dataview.
846
- */
847
- readShort() {
848
-
849
- const v = this.data.getInt16( this.position, true );
850
- this.position += 2;
851
- return v;
852
-
853
- }
854
-
855
- /**
856
- * Read 64 bit unsigned integer value.
857
- *
858
- * @method readDWord
859
- * @return {Number} Data read from the dataview.
860
- */
861
- readDWord() {
862
-
863
- const v = this.data.getUint32( this.position, true );
864
- this.position += 4;
865
- return v;
866
-
867
- }
868
-
869
- /**
870
- * Read 32 bit unsigned integer value.
871
- *
872
- * @method readWord
873
- * @return {Number} Data read from the dataview.
874
- */
875
- readWord() {
876
-
877
- const v = this.data.getUint16( this.position, true );
878
- this.position += 2;
879
- return v;
880
-
881
- }
882
-
883
- /**
884
- * Read NULL terminated ASCII string value from chunk-pos.
885
- *
886
- * @method readString
887
- * @return {String} Data read from the dataview.
888
- */
889
- readString() {
890
-
891
- let s = '';
892
- let c = this.readByte();
893
- while ( c ) {
894
-
895
- s += String.fromCharCode( c );
896
- c = this.readByte();
897
-
898
- }
899
-
900
- return s;
901
-
902
- }
903
-
904
- }
905
-
906
- // const NULL_CHUNK = 0x0000;
907
- const M3DMAGIC = 0x4D4D;
908
- // const SMAGIC = 0x2D2D;
909
- // const LMAGIC = 0x2D3D;
910
- const MLIBMAGIC = 0x3DAA;
911
- // const MATMAGIC = 0x3DFF;
912
- const CMAGIC = 0xC23D;
913
- const M3D_VERSION = 0x0002;
914
- // const M3D_KFVERSION = 0x0005;
915
- const COLOR_F = 0x0010;
916
- const COLOR_24 = 0x0011;
917
- const LIN_COLOR_24 = 0x0012;
918
- const LIN_COLOR_F = 0x0013;
919
- const INT_PERCENTAGE = 0x0030;
920
- const FLOAT_PERCENTAGE = 0x0031;
921
- const MDATA = 0x3D3D;
922
- const MESH_VERSION = 0x3D3E;
923
- const MASTER_SCALE = 0x0100;
924
- // const LO_SHADOW_BIAS = 0x1400;
925
- // const HI_SHADOW_BIAS = 0x1410;
926
- // const SHADOW_MAP_SIZE = 0x1420;
927
- // const SHADOW_SAMPLES = 0x1430;
928
- // const SHADOW_RANGE = 0x1440;
929
- // const SHADOW_FILTER = 0x1450;
930
- // const RAY_BIAS = 0x1460;
931
- // const O_CONSTS = 0x1500;
932
- // const AMBIENT_LIGHT = 0x2100;
933
- // const BIT_MAP = 0x1100;
934
- // const SOLID_BGND = 0x1200;
935
- // const V_GRADIENT = 0x1300;
936
- // const USE_BIT_MAP = 0x1101;
937
- // const USE_SOLID_BGND = 0x1201;
938
- // const USE_V_GRADIENT = 0x1301;
939
- // const FOG = 0x2200;
940
- // const FOG_BGND = 0x2210;
941
- // const LAYER_FOG = 0x2302;
942
- // const DISTANCE_CUE = 0x2300;
943
- // const DCUE_BGND = 0x2310;
944
- // const USE_FOG = 0x2201;
945
- // const USE_LAYER_FOG = 0x2303;
946
- // const USE_DISTANCE_CUE = 0x2301;
947
- const MAT_ENTRY = 0xAFFF;
948
- const MAT_NAME = 0xA000;
949
- const MAT_AMBIENT = 0xA010;
950
- const MAT_DIFFUSE = 0xA020;
951
- const MAT_SPECULAR = 0xA030;
952
- const MAT_SHININESS = 0xA040;
953
- // const MAT_SHIN2PCT = 0xA041;
954
- const MAT_TRANSPARENCY = 0xA050;
955
- // const MAT_XPFALL = 0xA052;
956
- // const MAT_USE_XPFALL = 0xA240;
957
- // const MAT_REFBLUR = 0xA053;
958
- // const MAT_SHADING = 0xA100;
959
- // const MAT_USE_REFBLUR = 0xA250;
960
- // const MAT_SELF_ILLUM = 0xA084;
961
- const MAT_TWO_SIDE = 0xA081;
962
- // const MAT_DECAL = 0xA082;
963
- const MAT_ADDITIVE = 0xA083;
964
- const MAT_WIRE = 0xA085;
965
- // const MAT_FACEMAP = 0xA088;
966
- // const MAT_TRANSFALLOFF_IN = 0xA08A;
967
- // const MAT_PHONGSOFT = 0xA08C;
968
- // const MAT_WIREABS = 0xA08E;
969
- const MAT_WIRE_SIZE = 0xA087;
970
- const MAT_TEXMAP = 0xA200;
971
- // const MAT_SXP_TEXT_DATA = 0xA320;
972
- // const MAT_TEXMASK = 0xA33E;
973
- // const MAT_SXP_TEXTMASK_DATA = 0xA32A;
974
- // const MAT_TEX2MAP = 0xA33A;
975
- // const MAT_SXP_TEXT2_DATA = 0xA321;
976
- // const MAT_TEX2MASK = 0xA340;
977
- // const MAT_SXP_TEXT2MASK_DATA = 0xA32C;
978
- const MAT_OPACMAP = 0xA210;
979
- // const MAT_SXP_OPAC_DATA = 0xA322;
980
- // const MAT_OPACMASK = 0xA342;
981
- // const MAT_SXP_OPACMASK_DATA = 0xA32E;
982
- const MAT_BUMPMAP = 0xA230;
983
- // const MAT_SXP_BUMP_DATA = 0xA324;
984
- // const MAT_BUMPMASK = 0xA344;
985
- // const MAT_SXP_BUMPMASK_DATA = 0xA330;
986
- const MAT_SPECMAP = 0xA204;
987
- // const MAT_SXP_SPEC_DATA = 0xA325;
988
- // const MAT_SPECMASK = 0xA348;
989
- // const MAT_SXP_SPECMASK_DATA = 0xA332;
990
- // const MAT_SHINMAP = 0xA33C;
991
- // const MAT_SXP_SHIN_DATA = 0xA326;
992
- // const MAT_SHINMASK = 0xA346;
993
- // const MAT_SXP_SHINMASK_DATA = 0xA334;
994
- // const MAT_SELFIMAP = 0xA33D;
995
- // const MAT_SXP_SELFI_DATA = 0xA328;
996
- // const MAT_SELFIMASK = 0xA34A;
997
- // const MAT_SXP_SELFIMASK_DATA = 0xA336;
998
- // const MAT_REFLMAP = 0xA220;
999
- // const MAT_REFLMASK = 0xA34C;
1000
- // const MAT_SXP_REFLMASK_DATA = 0xA338;
1001
- // const MAT_ACUBIC = 0xA310;
1002
- const MAT_MAPNAME = 0xA300;
1003
- // const MAT_MAP_TILING = 0xA351;
1004
- // const MAT_MAP_TEXBLUR = 0xA353;
1005
- const MAT_MAP_USCALE = 0xA354;
1006
- const MAT_MAP_VSCALE = 0xA356;
1007
- const MAT_MAP_UOFFSET = 0xA358;
1008
- const MAT_MAP_VOFFSET = 0xA35A;
1009
- // const MAT_MAP_ANG = 0xA35C;
1010
- // const MAT_MAP_COL1 = 0xA360;
1011
- // const MAT_MAP_COL2 = 0xA362;
1012
- // const MAT_MAP_RCOL = 0xA364;
1013
- // const MAT_MAP_GCOL = 0xA366;
1014
- // const MAT_MAP_BCOL = 0xA368;
1015
- const NAMED_OBJECT = 0x4000;
1016
- // const N_DIRECT_LIGHT = 0x4600;
1017
- // const DL_OFF = 0x4620;
1018
- // const DL_OUTER_RANGE = 0x465A;
1019
- // const DL_INNER_RANGE = 0x4659;
1020
- // const DL_MULTIPLIER = 0x465B;
1021
- // const DL_EXCLUDE = 0x4654;
1022
- // const DL_ATTENUATE = 0x4625;
1023
- // const DL_SPOTLIGHT = 0x4610;
1024
- // const DL_SPOT_ROLL = 0x4656;
1025
- // const DL_SHADOWED = 0x4630;
1026
- // const DL_LOCAL_SHADOW2 = 0x4641;
1027
- // const DL_SEE_CONE = 0x4650;
1028
- // const DL_SPOT_RECTANGULAR = 0x4651;
1029
- // const DL_SPOT_ASPECT = 0x4657;
1030
- // const DL_SPOT_PROJECTOR = 0x4653;
1031
- // const DL_SPOT_OVERSHOOT = 0x4652;
1032
- // const DL_RAY_BIAS = 0x4658;
1033
- // const DL_RAYSHAD = 0x4627;
1034
- // const N_CAMERA = 0x4700;
1035
- // const CAM_SEE_CONE = 0x4710;
1036
- // const CAM_RANGES = 0x4720;
1037
- // const OBJ_HIDDEN = 0x4010;
1038
- // const OBJ_VIS_LOFTER = 0x4011;
1039
- // const OBJ_DOESNT_CAST = 0x4012;
1040
- // const OBJ_DONT_RECVSHADOW = 0x4017;
1041
- // const OBJ_MATTE = 0x4013;
1042
- // const OBJ_FAST = 0x4014;
1043
- // const OBJ_PROCEDURAL = 0x4015;
1044
- // const OBJ_FROZEN = 0x4016;
1045
- const N_TRI_OBJECT = 0x4100;
1046
- const POINT_ARRAY = 0x4110;
1047
- // const POINT_FLAG_ARRAY = 0x4111;
1048
- const FACE_ARRAY = 0x4120;
1049
- const MSH_MAT_GROUP = 0x4130;
1050
- // const SMOOTH_GROUP = 0x4150;
1051
- // const MSH_BOXMAP = 0x4190;
1052
- const TEX_VERTS = 0x4140;
1053
- const MESH_MATRIX = 0x4160;
1054
- // const MESH_COLOR = 0x4165;
1055
- // const MESH_TEXTURE_INFO = 0x4170;
1056
- // const KFDATA = 0xB000;
1057
- // const KFHDR = 0xB00A;
1058
- // const KFSEG = 0xB008;
1059
- // const KFCURTIME = 0xB009;
1060
- // const AMBIENT_NODE_TAG = 0xB001;
1061
- // const OBJECT_NODE_TAG = 0xB002;
1062
- // const CAMERA_NODE_TAG = 0xB003;
1063
- // const TARGET_NODE_TAG = 0xB004;
1064
- // const LIGHT_NODE_TAG = 0xB005;
1065
- // const L_TARGET_NODE_TAG = 0xB006;
1066
- // const SPOTLIGHT_NODE_TAG = 0xB007;
1067
- // const NODE_ID = 0xB030;
1068
- // const NODE_HDR = 0xB010;
1069
- // const PIVOT = 0xB013;
1070
- // const INSTANCE_NAME = 0xB011;
1071
- // const MORPH_SMOOTH = 0xB015;
1072
- // const BOUNDBOX = 0xB014;
1073
- // const POS_TRACK_TAG = 0xB020;
1074
- // const COL_TRACK_TAG = 0xB025;
1075
- // const ROT_TRACK_TAG = 0xB021;
1076
- // const SCL_TRACK_TAG = 0xB022;
1077
- // const MORPH_TRACK_TAG = 0xB026;
1078
- // const FOV_TRACK_TAG = 0xB023;
1079
- // const ROLL_TRACK_TAG = 0xB024;
1080
- // const HOT_TRACK_TAG = 0xB027;
1081
- // const FALL_TRACK_TAG = 0xB028;
1082
- // const HIDE_TRACK_TAG = 0xB029;
1083
- // const POLY_2D = 0x5000;
1084
- // const SHAPE_OK = 0x5010;
1085
- // const SHAPE_NOT_OK = 0x5011;
1086
- // const SHAPE_HOOK = 0x5020;
1087
- // const PATH_3D = 0x6000;
1088
- // const PATH_MATRIX = 0x6005;
1089
- // const SHAPE_2D = 0x6010;
1090
- // const M_SCALE = 0x6020;
1091
- // const M_TWIST = 0x6030;
1092
- // const M_TEETER = 0x6040;
1093
- // const M_FIT = 0x6050;
1094
- // const M_BEVEL = 0x6060;
1095
- // const XZ_CURVE = 0x6070;
1096
- // const YZ_CURVE = 0x6080;
1097
- // const INTERPCT = 0x6090;
1098
- // const DEFORM_LIMIT = 0x60A0;
1099
- // const USE_CONTOUR = 0x6100;
1100
- // const USE_TWEEN = 0x6110;
1101
- // const USE_SCALE = 0x6120;
1102
- // const USE_TWIST = 0x6130;
1103
- // const USE_TEETER = 0x6140;
1104
- // const USE_FIT = 0x6150;
1105
- // const USE_BEVEL = 0x6160;
1106
- // const DEFAULT_VIEW = 0x3000;
1107
- // const VIEW_TOP = 0x3010;
1108
- // const VIEW_BOTTOM = 0x3020;
1109
- // const VIEW_LEFT = 0x3030;
1110
- // const VIEW_RIGHT = 0x3040;
1111
- // const VIEW_FRONT = 0x3050;
1112
- // const VIEW_BACK = 0x3060;
1113
- // const VIEW_USER = 0x3070;
1114
- // const VIEW_CAMERA = 0x3080;
1115
- // const VIEW_WINDOW = 0x3090;
1116
- // const VIEWPORT_LAYOUT_OLD = 0x7000;
1117
- // const VIEWPORT_DATA_OLD = 0x7010;
1118
- // const VIEWPORT_LAYOUT = 0x7001;
1119
- // const VIEWPORT_DATA = 0x7011;
1120
- // const VIEWPORT_DATA_3 = 0x7012;
1121
- // const VIEWPORT_SIZE = 0x7020;
1122
- // const NETWORK_VIEW = 0x7030;
1123
-
1124
- export { TDSLoader };
1
+ import {
2
+ AdditiveBlending,
3
+ BufferGeometry,
4
+ Color,
5
+ DoubleSide,
6
+ FileLoader,
7
+ Float32BufferAttribute,
8
+ Group,
9
+ Loader,
10
+ LoaderUtils,
11
+ Matrix4,
12
+ Mesh,
13
+ MeshPhongMaterial,
14
+ TextureLoader
15
+ } from 'three';
16
+
17
+ /**
18
+ * Autodesk 3DS three.js file loader, based on lib3ds.
19
+ *
20
+ * Loads geometry with uv and materials basic properties with texture support.
21
+ *
22
+ * @class TDSLoader
23
+ * @constructor
24
+ */
25
+
26
+ class TDSLoader extends Loader {
27
+
28
+ constructor( manager ) {
29
+
30
+ super( manager );
31
+
32
+ this.debug = false;
33
+
34
+ this.group = null;
35
+
36
+ this.materials = [];
37
+ this.meshes = [];
38
+
39
+ }
40
+
41
+ /**
42
+ * Load 3ds file from url.
43
+ *
44
+ * @method load
45
+ * @param {[type]} url URL for the file.
46
+ * @param {Function} onLoad onLoad callback, receives group Object3D as argument.
47
+ * @param {Function} onProgress onProgress callback.
48
+ * @param {Function} onError onError callback.
49
+ */
50
+ load( url, onLoad, onProgress, onError ) {
51
+
52
+ const scope = this;
53
+
54
+ const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;
55
+
56
+ const loader = new FileLoader( this.manager );
57
+ loader.setPath( this.path );
58
+ loader.setResponseType( 'arraybuffer' );
59
+ loader.setRequestHeader( this.requestHeader );
60
+ loader.setWithCredentials( this.withCredentials );
61
+
62
+ loader.load( url, function ( data ) {
63
+
64
+ try {
65
+
66
+ onLoad( scope.parse( data, path ) );
67
+
68
+ } catch ( e ) {
69
+
70
+ if ( onError ) {
71
+
72
+ onError( e );
73
+
74
+ } else {
75
+
76
+ console.error( e );
77
+
78
+ }
79
+
80
+ scope.manager.itemError( url );
81
+
82
+ }
83
+
84
+ }, onProgress, onError );
85
+
86
+ }
87
+
88
+ /**
89
+ * Parse arraybuffer data and load 3ds file.
90
+ *
91
+ * @method parse
92
+ * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
93
+ * @param {String} path Path for external resources.
94
+ * @return {Group} Group loaded from 3ds file.
95
+ */
96
+ parse( arraybuffer, path ) {
97
+
98
+ this.group = new Group();
99
+ this.materials = [];
100
+ this.meshes = [];
101
+
102
+ this.readFile( arraybuffer, path );
103
+
104
+ for ( let i = 0; i < this.meshes.length; i ++ ) {
105
+
106
+ this.group.add( this.meshes[ i ] );
107
+
108
+ }
109
+
110
+ return this.group;
111
+
112
+ }
113
+
114
+ /**
115
+ * Decode file content to read 3ds data.
116
+ *
117
+ * @method readFile
118
+ * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
119
+ * @param {String} path Path for external resources.
120
+ */
121
+ readFile( arraybuffer, path ) {
122
+
123
+ const data = new DataView( arraybuffer );
124
+ const chunk = new Chunk( data, 0, this.debugMessage );
125
+
126
+ if ( chunk.id === MLIBMAGIC || chunk.id === CMAGIC || chunk.id === M3DMAGIC ) {
127
+
128
+ let next = chunk.readChunk();
129
+
130
+ while ( next ) {
131
+
132
+ if ( next.id === M3D_VERSION ) {
133
+
134
+ const version = next.readDWord();
135
+ this.debugMessage( '3DS file version: ' + version );
136
+
137
+ } else if ( next.id === MDATA ) {
138
+
139
+ this.readMeshData( next, path );
140
+
141
+ } else {
142
+
143
+ this.debugMessage( 'Unknown main chunk: ' + next.hexId );
144
+
145
+ }
146
+
147
+ next = chunk.readChunk();
148
+
149
+ }
150
+
151
+ }
152
+
153
+ this.debugMessage( 'Parsed ' + this.meshes.length + ' meshes' );
154
+
155
+ }
156
+
157
+ /**
158
+ * Read mesh data chunk.
159
+ *
160
+ * @method readMeshData
161
+ * @param {Chunk} chunk to read mesh from
162
+ * @param {String} path Path for external resources.
163
+ */
164
+ readMeshData( chunk, path ) {
165
+
166
+ let next = chunk.readChunk();
167
+
168
+ while ( next ) {
169
+
170
+ if ( next.id === MESH_VERSION ) {
171
+
172
+ const version = + next.readDWord();
173
+ this.debugMessage( 'Mesh Version: ' + version );
174
+
175
+ } else if ( next.id === MASTER_SCALE ) {
176
+
177
+ const scale = next.readFloat();
178
+ this.debugMessage( 'Master scale: ' + scale );
179
+ this.group.scale.set( scale, scale, scale );
180
+
181
+ } else if ( next.id === NAMED_OBJECT ) {
182
+
183
+ this.debugMessage( 'Named Object' );
184
+ this.readNamedObject( next );
185
+
186
+ } else if ( next.id === MAT_ENTRY ) {
187
+
188
+ this.debugMessage( 'Material' );
189
+ this.readMaterialEntry( next, path );
190
+
191
+ } else {
192
+
193
+ this.debugMessage( 'Unknown MDATA chunk: ' + next.hexId );
194
+
195
+ }
196
+
197
+ next = chunk.readChunk();
198
+
199
+ }
200
+
201
+ }
202
+
203
+ /**
204
+ * Read named object chunk.
205
+ *
206
+ * @method readNamedObject
207
+ * @param {Chunk} chunk Chunk in use.
208
+ */
209
+ readNamedObject( chunk ) {
210
+
211
+ const name = chunk.readString();
212
+
213
+ let next = chunk.readChunk();
214
+ while ( next ) {
215
+
216
+ if ( next.id === N_TRI_OBJECT ) {
217
+
218
+ const mesh = this.readMesh( next );
219
+ mesh.name = name;
220
+ this.meshes.push( mesh );
221
+
222
+ } else {
223
+
224
+ this.debugMessage( 'Unknown named object chunk: ' + next.hexId );
225
+
226
+ }
227
+
228
+ next = chunk.readChunk( );
229
+
230
+ }
231
+
232
+ }
233
+
234
+ /**
235
+ * Read material data chunk and add it to the material list.
236
+ *
237
+ * @method readMaterialEntry
238
+ * @param {Chunk} chunk Chunk in use.
239
+ * @param {String} path Path for external resources.
240
+ */
241
+ readMaterialEntry( chunk, path ) {
242
+
243
+ let next = chunk.readChunk();
244
+ const material = new MeshPhongMaterial();
245
+
246
+ while ( next ) {
247
+
248
+ if ( next.id === MAT_NAME ) {
249
+
250
+ material.name = next.readString();
251
+ this.debugMessage( ' Name: ' + material.name );
252
+
253
+ } else if ( next.id === MAT_WIRE ) {
254
+
255
+ this.debugMessage( ' Wireframe' );
256
+ material.wireframe = true;
257
+
258
+ } else if ( next.id === MAT_WIRE_SIZE ) {
259
+
260
+ const value = next.readByte();
261
+ material.wireframeLinewidth = value;
262
+ this.debugMessage( ' Wireframe Thickness: ' + value );
263
+
264
+ } else if ( next.id === MAT_TWO_SIDE ) {
265
+
266
+ material.side = DoubleSide;
267
+ this.debugMessage( ' DoubleSided' );
268
+
269
+ } else if ( next.id === MAT_ADDITIVE ) {
270
+
271
+ this.debugMessage( ' Additive Blending' );
272
+ material.blending = AdditiveBlending;
273
+
274
+ } else if ( next.id === MAT_DIFFUSE ) {
275
+
276
+ this.debugMessage( ' Diffuse Color' );
277
+ material.color = this.readColor( next );
278
+
279
+ } else if ( next.id === MAT_SPECULAR ) {
280
+
281
+ this.debugMessage( ' Specular Color' );
282
+ material.specular = this.readColor( next );
283
+
284
+ } else if ( next.id === MAT_AMBIENT ) {
285
+
286
+ this.debugMessage( ' Ambient color' );
287
+ material.color = this.readColor( next );
288
+
289
+ } else if ( next.id === MAT_SHININESS ) {
290
+
291
+ const shininess = this.readPercentage( next );
292
+ material.shininess = shininess * 100;
293
+ this.debugMessage( ' Shininess : ' + shininess );
294
+
295
+ } else if ( next.id === MAT_TRANSPARENCY ) {
296
+
297
+ const transparency = this.readPercentage( next );
298
+ material.opacity = 1 - transparency;
299
+ this.debugMessage( ' Transparency : ' + transparency );
300
+ material.transparent = material.opacity < 1 ? true : false;
301
+
302
+ } else if ( next.id === MAT_TEXMAP ) {
303
+
304
+ this.debugMessage( ' ColorMap' );
305
+ material.map = this.readMap( next, path );
306
+
307
+ } else if ( next.id === MAT_BUMPMAP ) {
308
+
309
+ this.debugMessage( ' BumpMap' );
310
+ material.bumpMap = this.readMap( next, path );
311
+
312
+ } else if ( next.id === MAT_OPACMAP ) {
313
+
314
+ this.debugMessage( ' OpacityMap' );
315
+ material.alphaMap = this.readMap( next, path );
316
+
317
+ } else if ( next.id === MAT_SPECMAP ) {
318
+
319
+ this.debugMessage( ' SpecularMap' );
320
+ material.specularMap = this.readMap( next, path );
321
+
322
+ } else {
323
+
324
+ this.debugMessage( ' Unknown material chunk: ' + next.hexId );
325
+
326
+ }
327
+
328
+ next = chunk.readChunk();
329
+
330
+ }
331
+
332
+ this.materials[ material.name ] = material;
333
+
334
+ }
335
+
336
+ /**
337
+ * Read mesh data chunk.
338
+ *
339
+ * @method readMesh
340
+ * @param {Chunk} chunk Chunk in use.
341
+ * @return {Mesh} The parsed mesh.
342
+ */
343
+ readMesh( chunk ) {
344
+
345
+ let next = chunk.readChunk( );
346
+
347
+ const geometry = new BufferGeometry();
348
+
349
+ const material = new MeshPhongMaterial();
350
+ const mesh = new Mesh( geometry, material );
351
+ mesh.name = 'mesh';
352
+
353
+ while ( next ) {
354
+
355
+ if ( next.id === POINT_ARRAY ) {
356
+
357
+ const points = next.readWord( );
358
+
359
+ this.debugMessage( ' Vertex: ' + points );
360
+
361
+ //BufferGeometry
362
+
363
+ const vertices = [];
364
+
365
+ for ( let i = 0; i < points; i ++ ) {
366
+
367
+ vertices.push( next.readFloat( ) );
368
+ vertices.push( next.readFloat( ) );
369
+ vertices.push( next.readFloat( ) );
370
+
371
+ }
372
+
373
+ geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
374
+
375
+ } else if ( next.id === FACE_ARRAY ) {
376
+
377
+ this.readFaceArray( next, mesh );
378
+
379
+ } else if ( next.id === TEX_VERTS ) {
380
+
381
+ const texels = next.readWord( );
382
+
383
+ this.debugMessage( ' UV: ' + texels );
384
+
385
+ //BufferGeometry
386
+
387
+ const uvs = [];
388
+
389
+ for ( let i = 0; i < texels; i ++ ) {
390
+
391
+ uvs.push( next.readFloat( ) );
392
+ uvs.push( next.readFloat( ) );
393
+
394
+ }
395
+
396
+ geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
397
+
398
+
399
+ } else if ( next.id === MESH_MATRIX ) {
400
+
401
+ this.debugMessage( ' Tranformation Matrix (TODO)' );
402
+
403
+ const values = [];
404
+ for ( let i = 0; i < 12; i ++ ) {
405
+
406
+ values[ i ] = next.readFloat( );
407
+
408
+ }
409
+
410
+ const matrix = new Matrix4();
411
+
412
+ //X Line
413
+ matrix.elements[ 0 ] = values[ 0 ];
414
+ matrix.elements[ 1 ] = values[ 6 ];
415
+ matrix.elements[ 2 ] = values[ 3 ];
416
+ matrix.elements[ 3 ] = values[ 9 ];
417
+
418
+ //Y Line
419
+ matrix.elements[ 4 ] = values[ 2 ];
420
+ matrix.elements[ 5 ] = values[ 8 ];
421
+ matrix.elements[ 6 ] = values[ 5 ];
422
+ matrix.elements[ 7 ] = values[ 11 ];
423
+
424
+ //Z Line
425
+ matrix.elements[ 8 ] = values[ 1 ];
426
+ matrix.elements[ 9 ] = values[ 7 ];
427
+ matrix.elements[ 10 ] = values[ 4 ];
428
+ matrix.elements[ 11 ] = values[ 10 ];
429
+
430
+ //W Line
431
+ matrix.elements[ 12 ] = 0;
432
+ matrix.elements[ 13 ] = 0;
433
+ matrix.elements[ 14 ] = 0;
434
+ matrix.elements[ 15 ] = 1;
435
+
436
+ matrix.transpose();
437
+
438
+ const inverse = new Matrix4();
439
+ inverse.copy( matrix ).invert();
440
+ geometry.applyMatrix4( inverse );
441
+
442
+ matrix.decompose( mesh.position, mesh.quaternion, mesh.scale );
443
+
444
+ } else {
445
+
446
+ this.debugMessage( ' Unknown mesh chunk: ' + next.hexId );
447
+
448
+ }
449
+
450
+ next = chunk.readChunk( );
451
+
452
+ }
453
+
454
+ geometry.computeVertexNormals();
455
+
456
+ return mesh;
457
+
458
+ }
459
+
460
+ /**
461
+ * Read face array data chunk.
462
+ *
463
+ * @method readFaceArray
464
+ * @param {Chunk} chunk Chunk in use.
465
+ * @param {Mesh} mesh Mesh to be filled with the data read.
466
+ */
467
+ readFaceArray( chunk, mesh ) {
468
+
469
+ const faces = chunk.readWord( );
470
+
471
+ this.debugMessage( ' Faces: ' + faces );
472
+
473
+ const index = [];
474
+
475
+ for ( let i = 0; i < faces; ++ i ) {
476
+
477
+ index.push( chunk.readWord( ), chunk.readWord( ), chunk.readWord( ) );
478
+
479
+ chunk.readWord( ); // visibility
480
+
481
+ }
482
+
483
+ mesh.geometry.setIndex( index );
484
+
485
+ //The rest of the FACE_ARRAY chunk is subchunks
486
+
487
+ let materialIndex = 0;
488
+ let start = 0;
489
+
490
+ while ( ! chunk.endOfChunk ) {
491
+
492
+ const subchunk = chunk.readChunk( );
493
+
494
+ if ( subchunk.id === MSH_MAT_GROUP ) {
495
+
496
+ this.debugMessage( ' Material Group' );
497
+
498
+ const group = this.readMaterialGroup( subchunk );
499
+ const count = group.index.length * 3; // assuming successive indices
500
+
501
+ mesh.geometry.addGroup( start, count, materialIndex );
502
+
503
+ start += count;
504
+ materialIndex ++;
505
+
506
+ const material = this.materials[ group.name ];
507
+
508
+ if ( Array.isArray( mesh.material ) === false ) mesh.material = [];
509
+
510
+ if ( material !== undefined ) {
511
+
512
+ mesh.material.push( material );
513
+
514
+ }
515
+
516
+ } else {
517
+
518
+ this.debugMessage( ' Unknown face array chunk: ' + subchunk.hexId );
519
+
520
+ }
521
+
522
+ }
523
+
524
+ if ( mesh.material.length === 1 ) mesh.material = mesh.material[ 0 ]; // for backwards compatibility
525
+
526
+ }
527
+
528
+ /**
529
+ * Read texture map data chunk.
530
+ *
531
+ * @method readMap
532
+ * @param {Chunk} chunk Chunk in use.
533
+ * @param {String} path Path for external resources.
534
+ * @return {Texture} Texture read from this data chunk.
535
+ */
536
+ readMap( chunk, path ) {
537
+
538
+ let next = chunk.readChunk( );
539
+ let texture = {};
540
+
541
+ const loader = new TextureLoader( this.manager );
542
+ loader.setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
543
+
544
+ while ( next ) {
545
+
546
+ if ( next.id === MAT_MAPNAME ) {
547
+
548
+ const name = next.readString();
549
+ texture = loader.load( name );
550
+
551
+ this.debugMessage( ' File: ' + path + name );
552
+
553
+ } else if ( next.id === MAT_MAP_UOFFSET ) {
554
+
555
+ texture.offset.x = next.readFloat( );
556
+ this.debugMessage( ' OffsetX: ' + texture.offset.x );
557
+
558
+ } else if ( next.id === MAT_MAP_VOFFSET ) {
559
+
560
+ texture.offset.y = next.readFloat( );
561
+ this.debugMessage( ' OffsetY: ' + texture.offset.y );
562
+
563
+ } else if ( next.id === MAT_MAP_USCALE ) {
564
+
565
+ texture.repeat.x = next.readFloat( );
566
+ this.debugMessage( ' RepeatX: ' + texture.repeat.x );
567
+
568
+ } else if ( next.id === MAT_MAP_VSCALE ) {
569
+
570
+ texture.repeat.y = next.readFloat( );
571
+ this.debugMessage( ' RepeatY: ' + texture.repeat.y );
572
+
573
+ } else {
574
+
575
+ this.debugMessage( ' Unknown map chunk: ' + next.hexId );
576
+
577
+ }
578
+
579
+ next = chunk.readChunk( );
580
+
581
+ }
582
+
583
+ return texture;
584
+
585
+ }
586
+
587
+ /**
588
+ * Read material group data chunk.
589
+ *
590
+ * @method readMaterialGroup
591
+ * @param {Chunk} chunk Chunk in use.
592
+ * @return {Object} Object with name and index of the object.
593
+ */
594
+ readMaterialGroup( chunk ) {
595
+
596
+ const name = chunk.readString();
597
+ const numFaces = chunk.readWord();
598
+
599
+ this.debugMessage( ' Name: ' + name );
600
+ this.debugMessage( ' Faces: ' + numFaces );
601
+
602
+ const index = [];
603
+ for ( let i = 0; i < numFaces; ++ i ) {
604
+
605
+ index.push( chunk.readWord( ) );
606
+
607
+ }
608
+
609
+ return { name: name, index: index };
610
+
611
+ }
612
+
613
+ /**
614
+ * Read a color value.
615
+ *
616
+ * @method readColor
617
+ * @param {Chunk} chunk Chunk.
618
+ * @return {Color} Color value read..
619
+ */
620
+ readColor( chunk ) {
621
+
622
+ const subChunk = chunk.readChunk( );
623
+ const color = new Color();
624
+
625
+ if ( subChunk.id === COLOR_24 || subChunk.id === LIN_COLOR_24 ) {
626
+
627
+ const r = subChunk.readByte( );
628
+ const g = subChunk.readByte( );
629
+ const b = subChunk.readByte( );
630
+
631
+ color.setRGB( r / 255, g / 255, b / 255 );
632
+
633
+ this.debugMessage( ' Color: ' + color.r + ', ' + color.g + ', ' + color.b );
634
+
635
+ } else if ( subChunk.id === COLOR_F || subChunk.id === LIN_COLOR_F ) {
636
+
637
+ const r = subChunk.readFloat( );
638
+ const g = subChunk.readFloat( );
639
+ const b = subChunk.readFloat( );
640
+
641
+ color.setRGB( r, g, b );
642
+
643
+ this.debugMessage( ' Color: ' + color.r + ', ' + color.g + ', ' + color.b );
644
+
645
+ } else {
646
+
647
+ this.debugMessage( ' Unknown color chunk: ' + subChunk.hexId );
648
+
649
+ }
650
+
651
+ return color;
652
+
653
+ }
654
+
655
+ /**
656
+ * Read percentage value.
657
+ *
658
+ * @method readPercentage
659
+ * @param {Chunk} chunk Chunk to read data from.
660
+ * @return {Number} Data read from the dataview.
661
+ */
662
+ readPercentage( chunk ) {
663
+
664
+ const subChunk = chunk.readChunk( );
665
+
666
+ switch ( subChunk.id ) {
667
+
668
+ case INT_PERCENTAGE:
669
+ return ( subChunk.readShort( ) / 100 );
670
+ break;
671
+
672
+ case FLOAT_PERCENTAGE:
673
+ return subChunk.readFloat( );
674
+ break;
675
+
676
+ default:
677
+ this.debugMessage( ' Unknown percentage chunk: ' + subChunk.hexId );
678
+ return 0;
679
+
680
+ }
681
+
682
+ }
683
+
684
+ /**
685
+ * Print debug message to the console.
686
+ *
687
+ * Is controlled by a flag to show or hide debug messages.
688
+ *
689
+ * @method debugMessage
690
+ * @param {Object} message Debug message to print to the console.
691
+ */
692
+ debugMessage( message ) {
693
+
694
+ if ( this.debug ) {
695
+
696
+ console.log( message );
697
+
698
+ }
699
+
700
+ }
701
+
702
+ }
703
+
704
+
705
+ /** Read data/sub-chunks from chunk */
706
+ class Chunk {
707
+
708
+ /**
709
+ * Create a new chunk
710
+ *
711
+ * @class Chunk
712
+ * @param {DataView} data DataView to read from.
713
+ * @param {Number} position in data.
714
+ * @param {Function} debugMessage logging callback.
715
+ */
716
+ constructor( data, position, debugMessage ) {
717
+
718
+ this.data = data;
719
+ // the offset to the begin of this chunk
720
+ this.offset = position;
721
+ // the current reading position
722
+ this.position = position;
723
+ this.debugMessage = debugMessage;
724
+
725
+ if ( this.debugMessage instanceof Function ) {
726
+
727
+ this.debugMessage = function () {};
728
+
729
+ }
730
+
731
+ this.id = this.readWord();
732
+ this.size = this.readDWord();
733
+ this.end = this.offset + this.size;
734
+
735
+ if ( this.end > data.byteLength ) {
736
+
737
+ this.debugMessage( 'Bad chunk size for chunk at ' + position );
738
+
739
+ }
740
+
741
+ }
742
+
743
+ /**
744
+ * read a sub cchunk.
745
+ *
746
+ * @method readChunk
747
+ * @return {Chunk | null} next sub chunk
748
+ */
749
+ readChunk() {
750
+
751
+ if ( this.endOfChunk ) {
752
+
753
+ return null;
754
+
755
+ }
756
+
757
+ try {
758
+
759
+ const next = new Chunk( this.data, this.position, this.debugMessage );
760
+ this.position += next.size;
761
+ return next;
762
+
763
+ } catch ( e ) {
764
+
765
+ this.debugMessage( 'Unable to read chunk at ' + this.position );
766
+ return null;
767
+
768
+ }
769
+
770
+ }
771
+
772
+ /**
773
+ * return the ID of this chunk as Hex
774
+ *
775
+ * @method idToString
776
+ * @return {String} hex-string of id
777
+ */
778
+ get hexId() {
779
+
780
+ return this.id.toString( 16 );
781
+
782
+ }
783
+
784
+ get endOfChunk() {
785
+
786
+ return this.position >= this.end;
787
+
788
+ }
789
+
790
+ /**
791
+ * Read byte value.
792
+ *
793
+ * @method readByte
794
+ * @return {Number} Data read from the dataview.
795
+ */
796
+ readByte() {
797
+
798
+ const v = this.data.getUint8( this.position, true );
799
+ this.position += 1;
800
+ return v;
801
+
802
+ }
803
+
804
+ /**
805
+ * Read 32 bit float value.
806
+ *
807
+ * @method readFloat
808
+ * @return {Number} Data read from the dataview.
809
+ */
810
+ readFloat() {
811
+
812
+ try {
813
+
814
+ const v = this.data.getFloat32( this.position, true );
815
+ this.position += 4;
816
+ return v;
817
+
818
+ } catch ( e ) {
819
+
820
+ this.debugMessage( e + ' ' + this.position + ' ' + this.data.byteLength );
821
+ return 0;
822
+
823
+ }
824
+
825
+ }
826
+
827
+ /**
828
+ * Read 32 bit signed integer value.
829
+ *
830
+ * @method readInt
831
+ * @return {Number} Data read from the dataview.
832
+ */
833
+ readInt() {
834
+
835
+ const v = this.data.getInt32( this.position, true );
836
+ this.position += 4;
837
+ return v;
838
+
839
+ }
840
+
841
+ /**
842
+ * Read 16 bit signed integer value.
843
+ *
844
+ * @method readShort
845
+ * @return {Number} Data read from the dataview.
846
+ */
847
+ readShort() {
848
+
849
+ const v = this.data.getInt16( this.position, true );
850
+ this.position += 2;
851
+ return v;
852
+
853
+ }
854
+
855
+ /**
856
+ * Read 64 bit unsigned integer value.
857
+ *
858
+ * @method readDWord
859
+ * @return {Number} Data read from the dataview.
860
+ */
861
+ readDWord() {
862
+
863
+ const v = this.data.getUint32( this.position, true );
864
+ this.position += 4;
865
+ return v;
866
+
867
+ }
868
+
869
+ /**
870
+ * Read 32 bit unsigned integer value.
871
+ *
872
+ * @method readWord
873
+ * @return {Number} Data read from the dataview.
874
+ */
875
+ readWord() {
876
+
877
+ const v = this.data.getUint16( this.position, true );
878
+ this.position += 2;
879
+ return v;
880
+
881
+ }
882
+
883
+ /**
884
+ * Read NULL terminated ASCII string value from chunk-pos.
885
+ *
886
+ * @method readString
887
+ * @return {String} Data read from the dataview.
888
+ */
889
+ readString() {
890
+
891
+ let s = '';
892
+ let c = this.readByte();
893
+ while ( c ) {
894
+
895
+ s += String.fromCharCode( c );
896
+ c = this.readByte();
897
+
898
+ }
899
+
900
+ return s;
901
+
902
+ }
903
+
904
+ }
905
+
906
+ // const NULL_CHUNK = 0x0000;
907
+ const M3DMAGIC = 0x4D4D;
908
+ // const SMAGIC = 0x2D2D;
909
+ // const LMAGIC = 0x2D3D;
910
+ const MLIBMAGIC = 0x3DAA;
911
+ // const MATMAGIC = 0x3DFF;
912
+ const CMAGIC = 0xC23D;
913
+ const M3D_VERSION = 0x0002;
914
+ // const M3D_KFVERSION = 0x0005;
915
+ const COLOR_F = 0x0010;
916
+ const COLOR_24 = 0x0011;
917
+ const LIN_COLOR_24 = 0x0012;
918
+ const LIN_COLOR_F = 0x0013;
919
+ const INT_PERCENTAGE = 0x0030;
920
+ const FLOAT_PERCENTAGE = 0x0031;
921
+ const MDATA = 0x3D3D;
922
+ const MESH_VERSION = 0x3D3E;
923
+ const MASTER_SCALE = 0x0100;
924
+ // const LO_SHADOW_BIAS = 0x1400;
925
+ // const HI_SHADOW_BIAS = 0x1410;
926
+ // const SHADOW_MAP_SIZE = 0x1420;
927
+ // const SHADOW_SAMPLES = 0x1430;
928
+ // const SHADOW_RANGE = 0x1440;
929
+ // const SHADOW_FILTER = 0x1450;
930
+ // const RAY_BIAS = 0x1460;
931
+ // const O_CONSTS = 0x1500;
932
+ // const AMBIENT_LIGHT = 0x2100;
933
+ // const BIT_MAP = 0x1100;
934
+ // const SOLID_BGND = 0x1200;
935
+ // const V_GRADIENT = 0x1300;
936
+ // const USE_BIT_MAP = 0x1101;
937
+ // const USE_SOLID_BGND = 0x1201;
938
+ // const USE_V_GRADIENT = 0x1301;
939
+ // const FOG = 0x2200;
940
+ // const FOG_BGND = 0x2210;
941
+ // const LAYER_FOG = 0x2302;
942
+ // const DISTANCE_CUE = 0x2300;
943
+ // const DCUE_BGND = 0x2310;
944
+ // const USE_FOG = 0x2201;
945
+ // const USE_LAYER_FOG = 0x2303;
946
+ // const USE_DISTANCE_CUE = 0x2301;
947
+ const MAT_ENTRY = 0xAFFF;
948
+ const MAT_NAME = 0xA000;
949
+ const MAT_AMBIENT = 0xA010;
950
+ const MAT_DIFFUSE = 0xA020;
951
+ const MAT_SPECULAR = 0xA030;
952
+ const MAT_SHININESS = 0xA040;
953
+ // const MAT_SHIN2PCT = 0xA041;
954
+ const MAT_TRANSPARENCY = 0xA050;
955
+ // const MAT_XPFALL = 0xA052;
956
+ // const MAT_USE_XPFALL = 0xA240;
957
+ // const MAT_REFBLUR = 0xA053;
958
+ // const MAT_SHADING = 0xA100;
959
+ // const MAT_USE_REFBLUR = 0xA250;
960
+ // const MAT_SELF_ILLUM = 0xA084;
961
+ const MAT_TWO_SIDE = 0xA081;
962
+ // const MAT_DECAL = 0xA082;
963
+ const MAT_ADDITIVE = 0xA083;
964
+ const MAT_WIRE = 0xA085;
965
+ // const MAT_FACEMAP = 0xA088;
966
+ // const MAT_TRANSFALLOFF_IN = 0xA08A;
967
+ // const MAT_PHONGSOFT = 0xA08C;
968
+ // const MAT_WIREABS = 0xA08E;
969
+ const MAT_WIRE_SIZE = 0xA087;
970
+ const MAT_TEXMAP = 0xA200;
971
+ // const MAT_SXP_TEXT_DATA = 0xA320;
972
+ // const MAT_TEXMASK = 0xA33E;
973
+ // const MAT_SXP_TEXTMASK_DATA = 0xA32A;
974
+ // const MAT_TEX2MAP = 0xA33A;
975
+ // const MAT_SXP_TEXT2_DATA = 0xA321;
976
+ // const MAT_TEX2MASK = 0xA340;
977
+ // const MAT_SXP_TEXT2MASK_DATA = 0xA32C;
978
+ const MAT_OPACMAP = 0xA210;
979
+ // const MAT_SXP_OPAC_DATA = 0xA322;
980
+ // const MAT_OPACMASK = 0xA342;
981
+ // const MAT_SXP_OPACMASK_DATA = 0xA32E;
982
+ const MAT_BUMPMAP = 0xA230;
983
+ // const MAT_SXP_BUMP_DATA = 0xA324;
984
+ // const MAT_BUMPMASK = 0xA344;
985
+ // const MAT_SXP_BUMPMASK_DATA = 0xA330;
986
+ const MAT_SPECMAP = 0xA204;
987
+ // const MAT_SXP_SPEC_DATA = 0xA325;
988
+ // const MAT_SPECMASK = 0xA348;
989
+ // const MAT_SXP_SPECMASK_DATA = 0xA332;
990
+ // const MAT_SHINMAP = 0xA33C;
991
+ // const MAT_SXP_SHIN_DATA = 0xA326;
992
+ // const MAT_SHINMASK = 0xA346;
993
+ // const MAT_SXP_SHINMASK_DATA = 0xA334;
994
+ // const MAT_SELFIMAP = 0xA33D;
995
+ // const MAT_SXP_SELFI_DATA = 0xA328;
996
+ // const MAT_SELFIMASK = 0xA34A;
997
+ // const MAT_SXP_SELFIMASK_DATA = 0xA336;
998
+ // const MAT_REFLMAP = 0xA220;
999
+ // const MAT_REFLMASK = 0xA34C;
1000
+ // const MAT_SXP_REFLMASK_DATA = 0xA338;
1001
+ // const MAT_ACUBIC = 0xA310;
1002
+ const MAT_MAPNAME = 0xA300;
1003
+ // const MAT_MAP_TILING = 0xA351;
1004
+ // const MAT_MAP_TEXBLUR = 0xA353;
1005
+ const MAT_MAP_USCALE = 0xA354;
1006
+ const MAT_MAP_VSCALE = 0xA356;
1007
+ const MAT_MAP_UOFFSET = 0xA358;
1008
+ const MAT_MAP_VOFFSET = 0xA35A;
1009
+ // const MAT_MAP_ANG = 0xA35C;
1010
+ // const MAT_MAP_COL1 = 0xA360;
1011
+ // const MAT_MAP_COL2 = 0xA362;
1012
+ // const MAT_MAP_RCOL = 0xA364;
1013
+ // const MAT_MAP_GCOL = 0xA366;
1014
+ // const MAT_MAP_BCOL = 0xA368;
1015
+ const NAMED_OBJECT = 0x4000;
1016
+ // const N_DIRECT_LIGHT = 0x4600;
1017
+ // const DL_OFF = 0x4620;
1018
+ // const DL_OUTER_RANGE = 0x465A;
1019
+ // const DL_INNER_RANGE = 0x4659;
1020
+ // const DL_MULTIPLIER = 0x465B;
1021
+ // const DL_EXCLUDE = 0x4654;
1022
+ // const DL_ATTENUATE = 0x4625;
1023
+ // const DL_SPOTLIGHT = 0x4610;
1024
+ // const DL_SPOT_ROLL = 0x4656;
1025
+ // const DL_SHADOWED = 0x4630;
1026
+ // const DL_LOCAL_SHADOW2 = 0x4641;
1027
+ // const DL_SEE_CONE = 0x4650;
1028
+ // const DL_SPOT_RECTANGULAR = 0x4651;
1029
+ // const DL_SPOT_ASPECT = 0x4657;
1030
+ // const DL_SPOT_PROJECTOR = 0x4653;
1031
+ // const DL_SPOT_OVERSHOOT = 0x4652;
1032
+ // const DL_RAY_BIAS = 0x4658;
1033
+ // const DL_RAYSHAD = 0x4627;
1034
+ // const N_CAMERA = 0x4700;
1035
+ // const CAM_SEE_CONE = 0x4710;
1036
+ // const CAM_RANGES = 0x4720;
1037
+ // const OBJ_HIDDEN = 0x4010;
1038
+ // const OBJ_VIS_LOFTER = 0x4011;
1039
+ // const OBJ_DOESNT_CAST = 0x4012;
1040
+ // const OBJ_DONT_RECVSHADOW = 0x4017;
1041
+ // const OBJ_MATTE = 0x4013;
1042
+ // const OBJ_FAST = 0x4014;
1043
+ // const OBJ_PROCEDURAL = 0x4015;
1044
+ // const OBJ_FROZEN = 0x4016;
1045
+ const N_TRI_OBJECT = 0x4100;
1046
+ const POINT_ARRAY = 0x4110;
1047
+ // const POINT_FLAG_ARRAY = 0x4111;
1048
+ const FACE_ARRAY = 0x4120;
1049
+ const MSH_MAT_GROUP = 0x4130;
1050
+ // const SMOOTH_GROUP = 0x4150;
1051
+ // const MSH_BOXMAP = 0x4190;
1052
+ const TEX_VERTS = 0x4140;
1053
+ const MESH_MATRIX = 0x4160;
1054
+ // const MESH_COLOR = 0x4165;
1055
+ // const MESH_TEXTURE_INFO = 0x4170;
1056
+ // const KFDATA = 0xB000;
1057
+ // const KFHDR = 0xB00A;
1058
+ // const KFSEG = 0xB008;
1059
+ // const KFCURTIME = 0xB009;
1060
+ // const AMBIENT_NODE_TAG = 0xB001;
1061
+ // const OBJECT_NODE_TAG = 0xB002;
1062
+ // const CAMERA_NODE_TAG = 0xB003;
1063
+ // const TARGET_NODE_TAG = 0xB004;
1064
+ // const LIGHT_NODE_TAG = 0xB005;
1065
+ // const L_TARGET_NODE_TAG = 0xB006;
1066
+ // const SPOTLIGHT_NODE_TAG = 0xB007;
1067
+ // const NODE_ID = 0xB030;
1068
+ // const NODE_HDR = 0xB010;
1069
+ // const PIVOT = 0xB013;
1070
+ // const INSTANCE_NAME = 0xB011;
1071
+ // const MORPH_SMOOTH = 0xB015;
1072
+ // const BOUNDBOX = 0xB014;
1073
+ // const POS_TRACK_TAG = 0xB020;
1074
+ // const COL_TRACK_TAG = 0xB025;
1075
+ // const ROT_TRACK_TAG = 0xB021;
1076
+ // const SCL_TRACK_TAG = 0xB022;
1077
+ // const MORPH_TRACK_TAG = 0xB026;
1078
+ // const FOV_TRACK_TAG = 0xB023;
1079
+ // const ROLL_TRACK_TAG = 0xB024;
1080
+ // const HOT_TRACK_TAG = 0xB027;
1081
+ // const FALL_TRACK_TAG = 0xB028;
1082
+ // const HIDE_TRACK_TAG = 0xB029;
1083
+ // const POLY_2D = 0x5000;
1084
+ // const SHAPE_OK = 0x5010;
1085
+ // const SHAPE_NOT_OK = 0x5011;
1086
+ // const SHAPE_HOOK = 0x5020;
1087
+ // const PATH_3D = 0x6000;
1088
+ // const PATH_MATRIX = 0x6005;
1089
+ // const SHAPE_2D = 0x6010;
1090
+ // const M_SCALE = 0x6020;
1091
+ // const M_TWIST = 0x6030;
1092
+ // const M_TEETER = 0x6040;
1093
+ // const M_FIT = 0x6050;
1094
+ // const M_BEVEL = 0x6060;
1095
+ // const XZ_CURVE = 0x6070;
1096
+ // const YZ_CURVE = 0x6080;
1097
+ // const INTERPCT = 0x6090;
1098
+ // const DEFORM_LIMIT = 0x60A0;
1099
+ // const USE_CONTOUR = 0x6100;
1100
+ // const USE_TWEEN = 0x6110;
1101
+ // const USE_SCALE = 0x6120;
1102
+ // const USE_TWIST = 0x6130;
1103
+ // const USE_TEETER = 0x6140;
1104
+ // const USE_FIT = 0x6150;
1105
+ // const USE_BEVEL = 0x6160;
1106
+ // const DEFAULT_VIEW = 0x3000;
1107
+ // const VIEW_TOP = 0x3010;
1108
+ // const VIEW_BOTTOM = 0x3020;
1109
+ // const VIEW_LEFT = 0x3030;
1110
+ // const VIEW_RIGHT = 0x3040;
1111
+ // const VIEW_FRONT = 0x3050;
1112
+ // const VIEW_BACK = 0x3060;
1113
+ // const VIEW_USER = 0x3070;
1114
+ // const VIEW_CAMERA = 0x3080;
1115
+ // const VIEW_WINDOW = 0x3090;
1116
+ // const VIEWPORT_LAYOUT_OLD = 0x7000;
1117
+ // const VIEWPORT_DATA_OLD = 0x7010;
1118
+ // const VIEWPORT_LAYOUT = 0x7001;
1119
+ // const VIEWPORT_DATA = 0x7011;
1120
+ // const VIEWPORT_DATA_3 = 0x7012;
1121
+ // const VIEWPORT_SIZE = 0x7020;
1122
+ // const NETWORK_VIEW = 0x7030;
1123
+
1124
+ export { TDSLoader };