three-stdlib 2.25.0 → 2.25.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 (539) hide show
  1. package/index.cjs +116401 -611
  2. package/index.js +116037 -263
  3. package/package.json +17 -4
  4. package/_polyfill/CapsuleGeometry.cjs +0 -22
  5. package/_polyfill/CapsuleGeometry.js +0 -22
  6. package/_polyfill/CompressedArrayTexture.cjs +0 -12
  7. package/_polyfill/CompressedArrayTexture.js +0 -12
  8. package/_polyfill/Data3DTexture.cjs +0 -17
  9. package/_polyfill/Data3DTexture.js +0 -17
  10. package/animation/AnimationClipCreator.cjs +0 -56
  11. package/animation/AnimationClipCreator.js +0 -56
  12. package/animation/CCDIKSolver.cjs +0 -269
  13. package/animation/CCDIKSolver.js +0 -269
  14. package/animation/MMDAnimationHelper.cjs +0 -688
  15. package/animation/MMDAnimationHelper.js +0 -688
  16. package/animation/MMDPhysics.cjs +0 -830
  17. package/animation/MMDPhysics.js +0 -830
  18. package/cameras/CinematicCamera.cjs +0 -131
  19. package/cameras/CinematicCamera.js +0 -131
  20. package/controls/ArcballControls.cjs +0 -2033
  21. package/controls/ArcballControls.js +0 -2033
  22. package/controls/DeviceOrientationControls.cjs +0 -85
  23. package/controls/DeviceOrientationControls.js +0 -85
  24. package/controls/DragControls.cjs +0 -182
  25. package/controls/DragControls.js +0 -182
  26. package/controls/FirstPersonControls.cjs +0 -229
  27. package/controls/FirstPersonControls.js +0 -229
  28. package/controls/FlyControls.cjs +0 -248
  29. package/controls/FlyControls.js +0 -248
  30. package/controls/OrbitControls.cjs +0 -791
  31. package/controls/OrbitControls.js +0 -791
  32. package/controls/PointerLockControls.cjs +0 -103
  33. package/controls/PointerLockControls.js +0 -103
  34. package/controls/TrackballControls.cjs +0 -502
  35. package/controls/TrackballControls.js +0 -502
  36. package/controls/TransformControls.cjs +0 -1089
  37. package/controls/TransformControls.js +0 -1089
  38. package/controls/experimental/CameraControls.cjs +0 -736
  39. package/controls/experimental/CameraControls.js +0 -736
  40. package/csm/CSM.cjs +0 -244
  41. package/csm/CSM.js +0 -244
  42. package/csm/CSMFrustum.cjs +0 -75
  43. package/csm/CSMFrustum.js +0 -75
  44. package/csm/CSMHelper.cjs +0 -114
  45. package/csm/CSMHelper.js +0 -114
  46. package/csm/CSMShader.cjs +0 -261
  47. package/csm/CSMShader.js +0 -261
  48. package/curves/CurveExtras.cjs +0 -214
  49. package/curves/CurveExtras.js +0 -214
  50. package/curves/NURBSCurve.cjs +0 -35
  51. package/curves/NURBSCurve.js +0 -35
  52. package/curves/NURBSSurface.cjs +0 -28
  53. package/curves/NURBSSurface.js +0 -28
  54. package/curves/NURBSUtils.cjs +0 -226
  55. package/curves/NURBSUtils.js +0 -226
  56. package/deprecated/Geometry.cjs +0 -971
  57. package/deprecated/Geometry.js +0 -971
  58. package/effects/AnaglyphEffect.cjs +0 -102
  59. package/effects/AnaglyphEffect.js +0 -102
  60. package/effects/AsciiEffect.cjs +0 -155
  61. package/effects/AsciiEffect.js +0 -155
  62. package/effects/OutlineEffect.cjs +0 -275
  63. package/effects/OutlineEffect.js +0 -275
  64. package/effects/ParallaxBarrierEffect.cjs +0 -65
  65. package/effects/ParallaxBarrierEffect.js +0 -65
  66. package/effects/PeppersGhostEffect.cjs +0 -88
  67. package/effects/PeppersGhostEffect.js +0 -88
  68. package/effects/StereoEffect.cjs +0 -35
  69. package/effects/StereoEffect.js +0 -35
  70. package/environments/RoomEnvironment.cjs +0 -95
  71. package/environments/RoomEnvironment.js +0 -78
  72. package/exporters/ColladaExporter.cjs +0 -331
  73. package/exporters/ColladaExporter.js +0 -331
  74. package/exporters/DRACOExporter.cjs +0 -141
  75. package/exporters/DRACOExporter.js +0 -141
  76. package/exporters/GLTFExporter.cjs +0 -1909
  77. package/exporters/GLTFExporter.js +0 -1909
  78. package/exporters/MMDExporter.cjs +0 -131
  79. package/exporters/MMDExporter.js +0 -131
  80. package/exporters/OBJExporter.cjs +0 -181
  81. package/exporters/OBJExporter.js +0 -181
  82. package/exporters/PLYExporter.cjs +0 -280
  83. package/exporters/PLYExporter.js +0 -280
  84. package/exporters/STLExporter.cjs +0 -146
  85. package/exporters/STLExporter.js +0 -146
  86. package/exporters/USDZExporter.cjs +0 -340
  87. package/exporters/USDZExporter.js +0 -340
  88. package/geometries/BoxLineGeometry.cjs +0 -45
  89. package/geometries/BoxLineGeometry.js +0 -45
  90. package/geometries/ConvexGeometry.cjs +0 -26
  91. package/geometries/ConvexGeometry.js +0 -26
  92. package/geometries/DecalGeometry.cjs +0 -184
  93. package/geometries/DecalGeometry.js +0 -184
  94. package/geometries/LightningStrike.cjs +0 -553
  95. package/geometries/LightningStrike.js +0 -553
  96. package/geometries/ParametricGeometries.cjs +0 -130
  97. package/geometries/ParametricGeometries.js +0 -130
  98. package/geometries/ParametricGeometry.cjs +0 -63
  99. package/geometries/ParametricGeometry.js +0 -63
  100. package/geometries/RoundedBoxGeometry.cjs +0 -91
  101. package/geometries/RoundedBoxGeometry.js +0 -91
  102. package/geometries/TeapotGeometry.cjs +0 -1563
  103. package/geometries/TeapotGeometry.js +0 -1563
  104. package/geometries/TextGeometry.cjs +0 -27
  105. package/geometries/TextGeometry.js +0 -27
  106. package/helpers/LightProbeHelper.cjs +0 -73
  107. package/helpers/LightProbeHelper.js +0 -73
  108. package/helpers/PositionalAudioHelper.cjs +0 -68
  109. package/helpers/PositionalAudioHelper.js +0 -68
  110. package/helpers/RectAreaLightHelper.cjs +0 -44
  111. package/helpers/RectAreaLightHelper.js +0 -44
  112. package/helpers/VertexNormalsHelper.cjs +0 -47
  113. package/helpers/VertexNormalsHelper.js +0 -47
  114. package/helpers/VertexTangentsHelper.cjs +0 -43
  115. package/helpers/VertexTangentsHelper.js +0 -43
  116. package/interactive/HTMLMesh.cjs +0 -325
  117. package/interactive/HTMLMesh.js +0 -325
  118. package/interactive/InteractiveGroup.cjs +0 -68
  119. package/interactive/InteractiveGroup.js +0 -68
  120. package/interactive/SelectionBox.cjs +0 -134
  121. package/interactive/SelectionBox.js +0 -134
  122. package/interactive/SelectionHelper.cjs +0 -51
  123. package/interactive/SelectionHelper.js +0 -51
  124. package/libs/MeshoptDecoder.cjs +0 -221
  125. package/libs/MeshoptDecoder.js +0 -221
  126. package/libs/MotionControllers.cjs +0 -325
  127. package/libs/MotionControllers.js +0 -325
  128. package/lights/LightProbeGenerator.cjs +0 -145
  129. package/lights/LightProbeGenerator.js +0 -145
  130. package/lights/RectAreaLightUniformsLib.cjs +0 -32846
  131. package/lights/RectAreaLightUniformsLib.js +0 -32846
  132. package/lines/Line2.cjs +0 -13
  133. package/lines/Line2.js +0 -13
  134. package/lines/LineGeometry.cjs +0 -44
  135. package/lines/LineGeometry.js +0 -44
  136. package/lines/LineMaterial.cjs +0 -547
  137. package/lines/LineMaterial.js +0 -547
  138. package/lines/LineSegments2.cjs +0 -203
  139. package/lines/LineSegments2.js +0 -203
  140. package/lines/LineSegmentsGeometry.cjs +0 -124
  141. package/lines/LineSegmentsGeometry.js +0 -124
  142. package/lines/Wireframe.cjs +0 -32
  143. package/lines/Wireframe.js +0 -32
  144. package/lines/WireframeGeometry2.cjs +0 -13
  145. package/lines/WireframeGeometry2.js +0 -13
  146. package/loaders/3DMLoader.cjs +0 -803
  147. package/loaders/3DMLoader.js +0 -803
  148. package/loaders/3MFLoader.cjs +0 -854
  149. package/loaders/3MFLoader.js +0 -854
  150. package/loaders/AMFLoader.cjs +0 -284
  151. package/loaders/AMFLoader.js +0 -284
  152. package/loaders/AssimpLoader.cjs +0 -1434
  153. package/loaders/AssimpLoader.js +0 -1434
  154. package/loaders/BVHLoader.cjs +0 -207
  155. package/loaders/BVHLoader.js +0 -207
  156. package/loaders/BasisTextureLoader.cjs +0 -489
  157. package/loaders/BasisTextureLoader.js +0 -489
  158. package/loaders/ColladaLoader.cjs +0 -2405
  159. package/loaders/ColladaLoader.js +0 -2405
  160. package/loaders/DDSLoader.cjs +0 -148
  161. package/loaders/DDSLoader.js +0 -148
  162. package/loaders/DRACOLoader.cjs +0 -341
  163. package/loaders/DRACOLoader.js +0 -341
  164. package/loaders/EXRLoader.cjs +0 -1356
  165. package/loaders/EXRLoader.js +0 -1356
  166. package/loaders/FBXLoader.cjs +0 -2457
  167. package/loaders/FBXLoader.js +0 -2457
  168. package/loaders/FontLoader.cjs +0 -123
  169. package/loaders/FontLoader.js +0 -123
  170. package/loaders/GCodeLoader.cjs +0 -141
  171. package/loaders/GCodeLoader.js +0 -141
  172. package/loaders/GLTFLoader.cjs +0 -2504
  173. package/loaders/GLTFLoader.js +0 -2504
  174. package/loaders/HDRCubeTextureLoader.cjs +0 -75
  175. package/loaders/HDRCubeTextureLoader.js +0 -75
  176. package/loaders/KMZLoader.cjs +0 -75
  177. package/loaders/KMZLoader.js +0 -75
  178. package/loaders/KTX2Loader.cjs +0 -480
  179. package/loaders/KTX2Loader.js +0 -480
  180. package/loaders/KTXLoader.cjs +0 -93
  181. package/loaders/KTXLoader.js +0 -93
  182. package/loaders/LDrawLoader.cjs +0 -1424
  183. package/loaders/LDrawLoader.js +0 -1424
  184. package/loaders/LUT3dlLoader.cjs +0 -103
  185. package/loaders/LUT3dlLoader.js +0 -103
  186. package/loaders/LUTCubeLoader.cjs +0 -107
  187. package/loaders/LUTCubeLoader.js +0 -107
  188. package/loaders/LWOLoader.cjs +0 -645
  189. package/loaders/LWOLoader.js +0 -645
  190. package/loaders/LottieLoader.cjs +0 -47
  191. package/loaders/LottieLoader.js +0 -47
  192. package/loaders/MD2Loader.cjs +0 -359
  193. package/loaders/MD2Loader.js +0 -359
  194. package/loaders/MDDLoader.cjs +0 -58
  195. package/loaders/MDDLoader.js +0 -58
  196. package/loaders/MMDLoader.cjs +0 -1121
  197. package/loaders/MMDLoader.js +0 -1121
  198. package/loaders/MTLLoader.cjs +0 -304
  199. package/loaders/MTLLoader.js +0 -304
  200. package/loaders/NRRDLoader.cjs +0 -401
  201. package/loaders/NRRDLoader.js +0 -401
  202. package/loaders/OBJLoader.cjs +0 -487
  203. package/loaders/OBJLoader.js +0 -487
  204. package/loaders/PCDLoader.cjs +0 -248
  205. package/loaders/PCDLoader.js +0 -248
  206. package/loaders/PDBLoader.cjs +0 -247
  207. package/loaders/PDBLoader.js +0 -247
  208. package/loaders/PLYLoader.cjs +0 -317
  209. package/loaders/PLYLoader.js +0 -317
  210. package/loaders/PRWMLoader.cjs +0 -160
  211. package/loaders/PRWMLoader.js +0 -160
  212. package/loaders/PVRLoader.cjs +0 -131
  213. package/loaders/PVRLoader.js +0 -131
  214. package/loaders/RGBELoader.cjs +0 -252
  215. package/loaders/RGBELoader.js +0 -252
  216. package/loaders/RGBMLoader.cjs +0 -1004
  217. package/loaders/RGBMLoader.js +0 -1004
  218. package/loaders/STLLoader.cjs +0 -190
  219. package/loaders/STLLoader.js +0 -190
  220. package/loaders/SVGLoader.cjs +0 -1712
  221. package/loaders/SVGLoader.js +0 -1712
  222. package/loaders/TDSLoader.cjs +0 -650
  223. package/loaders/TDSLoader.js +0 -650
  224. package/loaders/TGALoader.cjs +0 -285
  225. package/loaders/TGALoader.js +0 -285
  226. package/loaders/TTFLoader.cjs +0 -131
  227. package/loaders/TTFLoader.js +0 -131
  228. package/loaders/TiltLoader.cjs +0 -375
  229. package/loaders/TiltLoader.js +0 -375
  230. package/loaders/VOXLoader.cjs +0 -432
  231. package/loaders/VOXLoader.js +0 -432
  232. package/loaders/VRMLLoader.cjs +0 -2105
  233. package/loaders/VRMLLoader.js +0 -2105
  234. package/loaders/VRMLoader.cjs +0 -38
  235. package/loaders/VRMLoader.js +0 -38
  236. package/loaders/VTKLoader.cjs +0 -648
  237. package/loaders/VTKLoader.js +0 -648
  238. package/loaders/XLoader.cjs +0 -1258
  239. package/loaders/XLoader.js +0 -1258
  240. package/loaders/XYZLoader.cjs +0 -60
  241. package/loaders/XYZLoader.js +0 -60
  242. package/loaders/lwo/IFFParser.cjs +0 -743
  243. package/loaders/lwo/IFFParser.js +0 -743
  244. package/loaders/lwo/LWO2Parser.cjs +0 -312
  245. package/loaders/lwo/LWO2Parser.js +0 -312
  246. package/loaders/lwo/LWO3Parser.cjs +0 -282
  247. package/loaders/lwo/LWO3Parser.js +0 -282
  248. package/math/Capsule.cjs +0 -98
  249. package/math/Capsule.js +0 -98
  250. package/math/ColorConverter.cjs +0 -42
  251. package/math/ColorConverter.js +0 -42
  252. package/math/ConvexHull.cjs +0 -596
  253. package/math/ConvexHull.js +0 -596
  254. package/math/ImprovedNoise.cjs +0 -304
  255. package/math/ImprovedNoise.js +0 -304
  256. package/math/Lut.cjs +0 -137
  257. package/math/Lut.js +0 -137
  258. package/math/MeshSurfaceSampler.cjs +0 -103
  259. package/math/MeshSurfaceSampler.js +0 -103
  260. package/math/OBB.cjs +0 -242
  261. package/math/OBB.js +0 -242
  262. package/math/Octree.cjs +0 -273
  263. package/math/Octree.js +0 -273
  264. package/math/SimplexNoise.cjs +0 -440
  265. package/math/SimplexNoise.js +0 -440
  266. package/misc/ConvexObjectBreaker.cjs +0 -292
  267. package/misc/ConvexObjectBreaker.js +0 -292
  268. package/misc/GPUComputationRenderer.cjs +0 -205
  269. package/misc/GPUComputationRenderer.js +0 -205
  270. package/misc/Gyroscope.cjs +0 -33
  271. package/misc/Gyroscope.js +0 -33
  272. package/misc/MD2Character.cjs +0 -167
  273. package/misc/MD2Character.js +0 -167
  274. package/misc/MD2CharacterComplex.cjs +0 -332
  275. package/misc/MD2CharacterComplex.js +0 -332
  276. package/misc/MorphAnimMesh.cjs +0 -40
  277. package/misc/MorphAnimMesh.js +0 -40
  278. package/misc/MorphBlendMesh.cjs +0 -179
  279. package/misc/MorphBlendMesh.js +0 -179
  280. package/misc/ProgressiveLightmap.cjs +0 -186
  281. package/misc/ProgressiveLightmap.js +0 -186
  282. package/misc/RollerCoaster.cjs +0 -353
  283. package/misc/RollerCoaster.js +0 -353
  284. package/misc/Timer.cjs +0 -101
  285. package/misc/Timer.js +0 -101
  286. package/misc/TubePainter.cjs +0 -123
  287. package/misc/TubePainter.js +0 -123
  288. package/misc/Volume.cjs +0 -305
  289. package/misc/Volume.js +0 -305
  290. package/misc/VolumeSlice.cjs +0 -114
  291. package/misc/VolumeSlice.js +0 -114
  292. package/misc/WebGL.cjs +0 -74
  293. package/misc/WebGL.js +0 -74
  294. package/modifiers/CurveModifier.cjs +0 -232
  295. package/modifiers/CurveModifier.js +0 -232
  296. package/modifiers/EdgeSplitModifier.cjs +0 -167
  297. package/modifiers/EdgeSplitModifier.js +0 -168
  298. package/modifiers/SimplifyModifier.cjs +0 -301
  299. package/modifiers/SimplifyModifier.js +0 -301
  300. package/modifiers/TessellateModifier.cjs +0 -214
  301. package/modifiers/TessellateModifier.js +0 -214
  302. package/objects/GroundProjectedEnv.cjs +0 -134
  303. package/objects/GroundProjectedEnv.js +0 -134
  304. package/objects/Lensflare.cjs +0 -291
  305. package/objects/Lensflare.js +0 -291
  306. package/objects/LightningStorm.cjs +0 -110
  307. package/objects/LightningStorm.js +0 -110
  308. package/objects/MarchingCubes.cjs +0 -4809
  309. package/objects/MarchingCubes.js +0 -4809
  310. package/objects/Reflector.cjs +0 -202
  311. package/objects/Reflector.js +0 -202
  312. package/objects/ReflectorForSSRPass.cjs +0 -260
  313. package/objects/ReflectorForSSRPass.js +0 -260
  314. package/objects/ReflectorRTT.cjs +0 -10
  315. package/objects/ReflectorRTT.js +0 -10
  316. package/objects/Refractor.cjs +0 -215
  317. package/objects/Refractor.js +0 -215
  318. package/objects/ShadowMesh.cjs +0 -45
  319. package/objects/ShadowMesh.js +0 -45
  320. package/objects/Sky.cjs +0 -200
  321. package/objects/Sky.js +0 -200
  322. package/objects/Water.cjs +0 -242
  323. package/objects/Water.js +0 -242
  324. package/objects/Water2.cjs +0 -256
  325. package/objects/Water2.js +0 -256
  326. package/physics/AmmoPhysics.cjs +0 -166
  327. package/physics/AmmoPhysics.js +0 -166
  328. package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
  329. package/postprocessing/AdaptiveToneMappingPass.js +0 -218
  330. package/postprocessing/AfterimagePass.cjs +0 -68
  331. package/postprocessing/AfterimagePass.js +0 -68
  332. package/postprocessing/BloomPass.cjs +0 -109
  333. package/postprocessing/BloomPass.js +0 -109
  334. package/postprocessing/BokehPass.cjs +0 -90
  335. package/postprocessing/BokehPass.js +0 -90
  336. package/postprocessing/ClearPass.cjs +0 -36
  337. package/postprocessing/ClearPass.js +0 -36
  338. package/postprocessing/CubeTexturePass.cjs +0 -53
  339. package/postprocessing/CubeTexturePass.js +0 -53
  340. package/postprocessing/DotScreenPass.cjs +0 -49
  341. package/postprocessing/DotScreenPass.js +0 -49
  342. package/postprocessing/EffectComposer.cjs +0 -157
  343. package/postprocessing/EffectComposer.js +0 -157
  344. package/postprocessing/FilmPass.cjs +0 -51
  345. package/postprocessing/FilmPass.js +0 -51
  346. package/postprocessing/GlitchPass.cjs +0 -84
  347. package/postprocessing/GlitchPass.js +0 -84
  348. package/postprocessing/HalftonePass.cjs +0 -53
  349. package/postprocessing/HalftonePass.js +0 -53
  350. package/postprocessing/LUTPass.cjs +0 -142
  351. package/postprocessing/LUTPass.js +0 -142
  352. package/postprocessing/MaskPass.cjs +0 -69
  353. package/postprocessing/MaskPass.js +0 -69
  354. package/postprocessing/OutlinePass.cjs +0 -479
  355. package/postprocessing/OutlinePass.js +0 -479
  356. package/postprocessing/Pass.cjs +0 -48
  357. package/postprocessing/Pass.js +0 -48
  358. package/postprocessing/RenderPass.cjs +0 -59
  359. package/postprocessing/RenderPass.js +0 -59
  360. package/postprocessing/RenderPixelatedPass.cjs +0 -199
  361. package/postprocessing/RenderPixelatedPass.js +0 -199
  362. package/postprocessing/SAOPass.cjs +0 -288
  363. package/postprocessing/SAOPass.js +0 -288
  364. package/postprocessing/SMAAPass.cjs +0 -112
  365. package/postprocessing/SMAAPass.js +0 -112
  366. package/postprocessing/SSAARenderPass.cjs +0 -189
  367. package/postprocessing/SSAARenderPass.js +0 -189
  368. package/postprocessing/SSAOPass.cjs +0 -272
  369. package/postprocessing/SSAOPass.js +0 -272
  370. package/postprocessing/SSRPass.cjs +0 -411
  371. package/postprocessing/SSRPass.js +0 -411
  372. package/postprocessing/SavePass.cjs +0 -38
  373. package/postprocessing/SavePass.js +0 -38
  374. package/postprocessing/ShaderPass.cjs +0 -49
  375. package/postprocessing/ShaderPass.js +0 -49
  376. package/postprocessing/TAARenderPass.cjs +0 -174
  377. package/postprocessing/TAARenderPass.js +0 -174
  378. package/postprocessing/TexturePass.cjs +0 -42
  379. package/postprocessing/TexturePass.js +0 -42
  380. package/postprocessing/UnrealBloomPass.cjs +0 -277
  381. package/postprocessing/UnrealBloomPass.js +0 -277
  382. package/postprocessing/WaterPass.cjs +0 -72
  383. package/postprocessing/WaterPass.js +0 -72
  384. package/renderers/CSS2DRenderer.cjs +0 -122
  385. package/renderers/CSS2DRenderer.js +0 -122
  386. package/renderers/CSS3DRenderer.cjs +0 -167
  387. package/renderers/CSS3DRenderer.js +0 -167
  388. package/renderers/Projector.cjs +0 -499
  389. package/renderers/Projector.js +0 -499
  390. package/renderers/SVGRenderer.cjs +0 -311
  391. package/renderers/SVGRenderer.js +0 -311
  392. package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
  393. package/shaders/ACESFilmicToneMappingShader.js +0 -55
  394. package/shaders/AfterimageShader.cjs +0 -32
  395. package/shaders/AfterimageShader.js +0 -32
  396. package/shaders/BasicShader.cjs +0 -12
  397. package/shaders/BasicShader.js +0 -12
  398. package/shaders/BleachBypassShader.cjs +0 -35
  399. package/shaders/BleachBypassShader.js +0 -35
  400. package/shaders/BlendShader.cjs +0 -30
  401. package/shaders/BlendShader.js +0 -30
  402. package/shaders/BokehShader.cjs +0 -109
  403. package/shaders/BokehShader.js +0 -109
  404. package/shaders/BokehShader2.cjs +0 -269
  405. package/shaders/BokehShader2.js +0 -269
  406. package/shaders/BrightnessContrastShader.cjs +0 -32
  407. package/shaders/BrightnessContrastShader.js +0 -32
  408. package/shaders/ColorCorrectionShader.cjs +0 -30
  409. package/shaders/ColorCorrectionShader.js +0 -30
  410. package/shaders/ColorifyShader.cjs +0 -28
  411. package/shaders/ColorifyShader.js +0 -28
  412. package/shaders/ConvolutionShader.cjs +0 -55
  413. package/shaders/ConvolutionShader.js +0 -55
  414. package/shaders/CopyShader.cjs +0 -25
  415. package/shaders/CopyShader.js +0 -25
  416. package/shaders/DOFMipMapShader.cjs +0 -32
  417. package/shaders/DOFMipMapShader.js +0 -32
  418. package/shaders/DepthLimitedBlurShader.cjs +0 -114
  419. package/shaders/DepthLimitedBlurShader.js +0 -114
  420. package/shaders/DigitalGlitch.cjs +0 -85
  421. package/shaders/DigitalGlitch.js +0 -85
  422. package/shaders/DotScreenShader.cjs +0 -39
  423. package/shaders/DotScreenShader.js +0 -39
  424. package/shaders/FXAAShader.cjs +0 -1098
  425. package/shaders/FXAAShader.js +0 -1098
  426. package/shaders/FilmShader.cjs +0 -53
  427. package/shaders/FilmShader.js +0 -53
  428. package/shaders/FocusShader.cjs +0 -55
  429. package/shaders/FocusShader.js +0 -55
  430. package/shaders/FreiChenShader.cjs +0 -64
  431. package/shaders/FreiChenShader.js +0 -64
  432. package/shaders/FresnelShader.cjs +0 -47
  433. package/shaders/FresnelShader.js +0 -47
  434. package/shaders/GammaCorrectionShader.cjs +0 -23
  435. package/shaders/GammaCorrectionShader.js +0 -23
  436. package/shaders/GodRaysShader.cjs +0 -183
  437. package/shaders/GodRaysShader.js +0 -183
  438. package/shaders/HalftoneShader.cjs +0 -228
  439. package/shaders/HalftoneShader.js +0 -228
  440. package/shaders/HorizontalBlurShader.cjs +0 -49
  441. package/shaders/HorizontalBlurShader.js +0 -49
  442. package/shaders/HorizontalTiltShiftShader.cjs +0 -37
  443. package/shaders/HorizontalTiltShiftShader.js +0 -37
  444. package/shaders/HueSaturationShader.cjs +0 -43
  445. package/shaders/HueSaturationShader.js +0 -43
  446. package/shaders/KaleidoShader.cjs +0 -34
  447. package/shaders/KaleidoShader.js +0 -34
  448. package/shaders/LuminosityHighPassShader.cjs +0 -37
  449. package/shaders/LuminosityHighPassShader.js +0 -37
  450. package/shaders/LuminosityShader.cjs +0 -25
  451. package/shaders/LuminosityShader.js +0 -25
  452. package/shaders/MirrorShader.cjs +0 -35
  453. package/shaders/MirrorShader.js +0 -35
  454. package/shaders/NormalMapShader.cjs +0 -31
  455. package/shaders/NormalMapShader.js +0 -31
  456. package/shaders/ParallaxShader.cjs +0 -133
  457. package/shaders/ParallaxShader.js +0 -133
  458. package/shaders/PixelShader.cjs +0 -28
  459. package/shaders/PixelShader.js +0 -28
  460. package/shaders/RGBShiftShader.cjs +0 -30
  461. package/shaders/RGBShiftShader.js +0 -30
  462. package/shaders/SAOShader.cjs +0 -144
  463. package/shaders/SAOShader.js +0 -144
  464. package/shaders/SMAAShader.cjs +0 -358
  465. package/shaders/SMAAShader.js +0 -358
  466. package/shaders/SSAOShader.cjs +0 -182
  467. package/shaders/SSAOShader.js +0 -182
  468. package/shaders/SSRShader.cjs +0 -342
  469. package/shaders/SSRShader.js +0 -342
  470. package/shaders/SepiaShader.cjs +0 -29
  471. package/shaders/SepiaShader.js +0 -29
  472. package/shaders/SobelOperatorShader.cjs +0 -54
  473. package/shaders/SobelOperatorShader.js +0 -54
  474. package/shaders/SubsurfaceScatteringShader.cjs +0 -98
  475. package/shaders/SubsurfaceScatteringShader.js +0 -98
  476. package/shaders/TechnicolorShader.cjs +0 -24
  477. package/shaders/TechnicolorShader.js +0 -24
  478. package/shaders/ToneMapShader.cjs +0 -51
  479. package/shaders/ToneMapShader.js +0 -51
  480. package/shaders/ToonShader.cjs +0 -188
  481. package/shaders/ToonShader.js +0 -188
  482. package/shaders/TriangleBlurShader.cjs +0 -37
  483. package/shaders/TriangleBlurShader.js +0 -37
  484. package/shaders/UnpackDepthRGBAShader.cjs +0 -26
  485. package/shaders/UnpackDepthRGBAShader.js +0 -26
  486. package/shaders/VerticalBlurShader.cjs +0 -50
  487. package/shaders/VerticalBlurShader.js +0 -50
  488. package/shaders/VerticalTiltShiftShader.cjs +0 -37
  489. package/shaders/VerticalTiltShiftShader.js +0 -37
  490. package/shaders/VignetteShader.cjs +0 -38
  491. package/shaders/VignetteShader.js +0 -38
  492. package/shaders/VolumeShader.cjs +0 -225
  493. package/shaders/VolumeShader.js +0 -225
  494. package/shaders/WaterRefractionShader.cjs +0 -59
  495. package/shaders/WaterRefractionShader.js +0 -59
  496. package/shaders/types.cjs +0 -1
  497. package/shaders/types.js +0 -1
  498. package/textures/FlakesTexture.cjs +0 -30
  499. package/textures/FlakesTexture.js +0 -30
  500. package/types/helpers.cjs +0 -4
  501. package/types/helpers.js +0 -4
  502. package/utils/BufferGeometryUtils.cjs +0 -636
  503. package/utils/BufferGeometryUtils.js +0 -636
  504. package/utils/GeometryCompressionUtils.cjs +0 -573
  505. package/utils/GeometryCompressionUtils.js +0 -573
  506. package/utils/GeometryUtils.cjs +0 -109
  507. package/utils/GeometryUtils.js +0 -109
  508. package/utils/RoughnessMipmapper.cjs +0 -223
  509. package/utils/RoughnessMipmapper.js +0 -223
  510. package/utils/SceneUtils.cjs +0 -36
  511. package/utils/SceneUtils.js +0 -36
  512. package/utils/ShadowMapViewer.cjs +0 -111
  513. package/utils/ShadowMapViewer.js +0 -111
  514. package/utils/SkeletonUtils.cjs +0 -211
  515. package/utils/SkeletonUtils.js +0 -211
  516. package/utils/UVsDebug.cjs +0 -80
  517. package/utils/UVsDebug.js +0 -80
  518. package/utils/WorkerPool.cjs +0 -62
  519. package/utils/WorkerPool.js +0 -62
  520. package/webxr/ARButton.cjs +0 -119
  521. package/webxr/ARButton.js +0 -119
  522. package/webxr/OculusHandModel.cjs +0 -82
  523. package/webxr/OculusHandModel.js +0 -82
  524. package/webxr/OculusHandPointerModel.cjs +0 -241
  525. package/webxr/OculusHandPointerModel.js +0 -224
  526. package/webxr/Text2D.cjs +0 -48
  527. package/webxr/Text2D.js +0 -31
  528. package/webxr/VRButton.cjs +0 -111
  529. package/webxr/VRButton.js +0 -111
  530. package/webxr/XRControllerModelFactory.cjs +0 -174
  531. package/webxr/XRControllerModelFactory.js +0 -174
  532. package/webxr/XREstimatedLight.cjs +0 -126
  533. package/webxr/XREstimatedLight.js +0 -126
  534. package/webxr/XRHandMeshModel.cjs +0 -82
  535. package/webxr/XRHandMeshModel.js +0 -82
  536. package/webxr/XRHandModelFactory.cjs +0 -61
  537. package/webxr/XRHandModelFactory.js +0 -61
  538. package/webxr/XRHandPrimitiveModel.cjs +0 -68
  539. package/webxr/XRHandPrimitiveModel.js +0 -68
@@ -1,1434 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const THREE = require("three");
4
- class AssimpLoader extends THREE.Loader {
5
- load(url, onLoad, onProgress, onError) {
6
- var scope = this;
7
- var path = scope.path === "" ? THREE.LoaderUtils.extractUrlBase(url) : scope.path;
8
- var loader = new THREE.FileLoader(scope.manager);
9
- loader.setPath(scope.path);
10
- loader.setResponseType("arraybuffer");
11
- loader.setRequestHeader(scope.requestHeader);
12
- loader.setWithCredentials(scope.withCredentials);
13
- loader.load(
14
- url,
15
- function(buffer) {
16
- try {
17
- onLoad(scope.parse(buffer, path));
18
- } catch (e) {
19
- if (onError) {
20
- onError(e);
21
- } else {
22
- console.error(e);
23
- }
24
- scope.manager.itemError(url);
25
- }
26
- },
27
- onProgress,
28
- onError
29
- );
30
- }
31
- parse(buffer, path) {
32
- var textureLoader = new THREE.TextureLoader(this.manager);
33
- textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);
34
- var Virtulous = {};
35
- Virtulous.KeyFrame = class {
36
- constructor(time, matrix) {
37
- this.time = time;
38
- this.matrix = matrix.clone();
39
- this.position = new THREE.Vector3();
40
- this.quaternion = new THREE.Quaternion();
41
- this.scale = new THREE.Vector3(1, 1, 1);
42
- this.matrix.decompose(this.position, this.quaternion, this.scale);
43
- this.clone = function() {
44
- var n = new Virtulous.KeyFrame(this.time, this.matrix);
45
- return n;
46
- };
47
- this.lerp = function(nextKey, time2) {
48
- time2 -= this.time;
49
- var dist = nextKey.time - this.time;
50
- var l = time2 / dist;
51
- var l2 = 1 - l;
52
- var keypos = this.position;
53
- var keyrot = this.quaternion;
54
- var key2pos = nextKey.position;
55
- var key2rot = nextKey.quaternion;
56
- Virtulous.KeyFrame.tempAniPos.x = keypos.x * l2 + key2pos.x * l;
57
- Virtulous.KeyFrame.tempAniPos.y = keypos.y * l2 + key2pos.y * l;
58
- Virtulous.KeyFrame.tempAniPos.z = keypos.z * l2 + key2pos.z * l;
59
- Virtulous.KeyFrame.tempAniQuat.set(keyrot.x, keyrot.y, keyrot.z, keyrot.w);
60
- Virtulous.KeyFrame.tempAniQuat.slerp(key2rot, l);
61
- return Virtulous.KeyFrame.tempAniMatrix.compose(
62
- Virtulous.KeyFrame.tempAniPos,
63
- Virtulous.KeyFrame.tempAniQuat,
64
- Virtulous.KeyFrame.tempAniScale
65
- );
66
- };
67
- }
68
- };
69
- Virtulous.KeyFrame.tempAniPos = new THREE.Vector3();
70
- Virtulous.KeyFrame.tempAniQuat = new THREE.Quaternion();
71
- Virtulous.KeyFrame.tempAniScale = new THREE.Vector3(1, 1, 1);
72
- Virtulous.KeyFrame.tempAniMatrix = new THREE.Matrix4();
73
- Virtulous.KeyFrameTrack = function() {
74
- this.keys = [];
75
- this.target = null;
76
- this.time = 0;
77
- this.length = 0;
78
- this._accelTable = {};
79
- this.fps = 20;
80
- this.addKey = function(key) {
81
- this.keys.push(key);
82
- };
83
- this.init = function() {
84
- this.sortKeys();
85
- if (this.keys.length > 0)
86
- this.length = this.keys[this.keys.length - 1].time;
87
- else
88
- this.length = 0;
89
- if (!this.fps)
90
- return;
91
- for (let j = 0; j < this.length * this.fps; j++) {
92
- for (let i = 0; i < this.keys.length; i++) {
93
- if (this.keys[i].time == j) {
94
- this._accelTable[j] = i;
95
- break;
96
- } else if (this.keys[i].time < j / this.fps && this.keys[i + 1] && this.keys[i + 1].time >= j / this.fps) {
97
- this._accelTable[j] = i;
98
- break;
99
- }
100
- }
101
- }
102
- };
103
- this.parseFromThree = function(data) {
104
- var fps = data.fps;
105
- this.target = data.node;
106
- var track = data.hierarchy[0].keys;
107
- for (let i = 0; i < track.length; i++) {
108
- this.addKey(new Virtulous.KeyFrame(i / fps || track[i].time, track[i].targets[0].data));
109
- }
110
- this.init();
111
- };
112
- this.parseFromCollada = function(data) {
113
- var track = data.keys;
114
- var fps = this.fps;
115
- for (let i = 0; i < track.length; i++) {
116
- this.addKey(new Virtulous.KeyFrame(i / fps || track[i].time, track[i].matrix));
117
- }
118
- this.init();
119
- };
120
- this.sortKeys = function() {
121
- this.keys.sort(this.keySortFunc);
122
- };
123
- this.keySortFunc = function(a, b) {
124
- return a.time - b.time;
125
- };
126
- this.clone = function() {
127
- var t = new Virtulous.KeyFrameTrack();
128
- t.target = this.target;
129
- t.time = this.time;
130
- t.length = this.length;
131
- for (let i = 0; i < this.keys.length; i++) {
132
- t.addKey(this.keys[i].clone());
133
- }
134
- t.init();
135
- return t;
136
- };
137
- this.reTarget = function(root, compareitor) {
138
- if (!compareitor)
139
- compareitor = Virtulous.TrackTargetNodeNameCompare;
140
- this.target = compareitor(root, this.target);
141
- };
142
- this.keySearchAccel = function(time) {
143
- time *= this.fps;
144
- time = Math.floor(time);
145
- return this._accelTable[time] || 0;
146
- };
147
- this.setTime = function(time) {
148
- time = Math.abs(time);
149
- if (this.length)
150
- time = time % this.length + 0.05;
151
- var key0 = null;
152
- var key1 = null;
153
- for (let i = this.keySearchAccel(time); i < this.keys.length; i++) {
154
- if (this.keys[i].time == time) {
155
- key0 = this.keys[i];
156
- key1 = this.keys[i];
157
- break;
158
- } else if (this.keys[i].time < time && this.keys[i + 1] && this.keys[i + 1].time > time) {
159
- key0 = this.keys[i];
160
- key1 = this.keys[i + 1];
161
- break;
162
- } else if (this.keys[i].time < time && i == this.keys.length - 1) {
163
- key0 = this.keys[i];
164
- key1 = this.keys[0].clone();
165
- key1.time += this.length + 0.05;
166
- break;
167
- }
168
- }
169
- if (key0 && key1 && key0 !== key1) {
170
- this.target.matrixAutoUpdate = false;
171
- this.target.matrix.copy(key0.lerp(key1, time));
172
- this.target.matrixWorldNeedsUpdate = true;
173
- return;
174
- }
175
- if (key0 && key1 && key0 == key1) {
176
- this.target.matrixAutoUpdate = false;
177
- this.target.matrix.copy(key0.matrix);
178
- this.target.matrixWorldNeedsUpdate = true;
179
- return;
180
- }
181
- };
182
- };
183
- Virtulous.TrackTargetNodeNameCompare = function(root, target) {
184
- function find(node, name) {
185
- if (node.name == name)
186
- return node;
187
- for (let i = 0; i < node.children.length; i++) {
188
- var r = find(node.children[i], name);
189
- if (r)
190
- return r;
191
- }
192
- return null;
193
- }
194
- return find(root, target.name);
195
- };
196
- Virtulous.Animation = function() {
197
- this.tracks = [];
198
- this.length = 0;
199
- this.addTrack = function(track) {
200
- this.tracks.push(track);
201
- this.length = Math.max(track.length, this.length);
202
- };
203
- this.setTime = function(time) {
204
- this.time = time;
205
- for (let i = 0; i < this.tracks.length; i++)
206
- this.tracks[i].setTime(time);
207
- };
208
- this.clone = function(target, compareitor) {
209
- if (!compareitor)
210
- compareitor = Virtulous.TrackTargetNodeNameCompare;
211
- var n = new Virtulous.Animation();
212
- n.target = target;
213
- for (let i = 0; i < this.tracks.length; i++) {
214
- var track = this.tracks[i].clone();
215
- track.reTarget(target, compareitor);
216
- n.addTrack(track);
217
- }
218
- return n;
219
- };
220
- };
221
- var ASSBIN_CHUNK_AICAMERA = 4660;
222
- var ASSBIN_CHUNK_AILIGHT = 4661;
223
- var ASSBIN_CHUNK_AITEXTURE = 4662;
224
- var ASSBIN_CHUNK_AIMESH = 4663;
225
- var ASSBIN_CHUNK_AINODEANIM = 4664;
226
- var ASSBIN_CHUNK_AISCENE = 4665;
227
- var ASSBIN_CHUNK_AIBONE = 4666;
228
- var ASSBIN_CHUNK_AIANIMATION = 4667;
229
- var ASSBIN_CHUNK_AINODE = 4668;
230
- var ASSBIN_CHUNK_AIMATERIAL = 4669;
231
- var ASSBIN_CHUNK_AIMATERIALPROPERTY = 4670;
232
- var ASSBIN_MESH_HAS_POSITIONS = 1;
233
- var ASSBIN_MESH_HAS_NORMALS = 2;
234
- var ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS = 4;
235
- var ASSBIN_MESH_HAS_TEXCOORD_BASE = 256;
236
- var ASSBIN_MESH_HAS_COLOR_BASE = 65536;
237
- var AI_MAX_NUMBER_OF_COLOR_SETS = 1;
238
- var AI_MAX_NUMBER_OF_TEXTURECOORDS = 4;
239
- //! A directional light source has a well-defined direction
240
- //! but is infinitely far away. That's quite a good
241
- //! approximation for sun light.
242
- var aiLightSource_DIRECTIONAL = 1;
243
- //! A point light source has a well-defined position
244
- //! in space but no direction - it emits light in all
245
- //! directions. A normal bulb is a point light.
246
- //! A spot light source emits light in a specific
247
- //! angle. It has a position and a direction it is pointing to.
248
- //! A good example for a spot light is a light spot in
249
- //! sport arenas.
250
- var aiLightSource_SPOT = 3;
251
- //! The generic light level of the world, including the bounces
252
- //! of all other lightsources.
253
- //! Typically, there's at most one ambient light in a scene.
254
- //! This light type doesn't have a valid position, direction, or
255
- //! other properties, just a color.
256
- var aiTextureType_DIFFUSE = 1;
257
- var aiTextureType_NORMALS = 6;
258
- var aiTextureType_OPACITY = 8;
259
- var aiTextureType_LIGHTMAP = 10;
260
- var BONESPERVERT = 4;
261
- function ASSBIN_MESH_HAS_TEXCOORD(n) {
262
- return ASSBIN_MESH_HAS_TEXCOORD_BASE << n;
263
- }
264
- function ASSBIN_MESH_HAS_COLOR(n) {
265
- return ASSBIN_MESH_HAS_COLOR_BASE << n;
266
- }
267
- function markBones(scene) {
268
- for (let i in scene.mMeshes) {
269
- var mesh = scene.mMeshes[i];
270
- for (let k in mesh.mBones) {
271
- var boneNode = scene.findNode(mesh.mBones[k].mName);
272
- if (boneNode)
273
- boneNode.isBone = true;
274
- }
275
- }
276
- }
277
- function cloneTreeToBones(root, scene) {
278
- var rootBone = new THREE.Bone();
279
- rootBone.matrix.copy(root.matrix);
280
- rootBone.matrixWorld.copy(root.matrixWorld);
281
- rootBone.position.copy(root.position);
282
- rootBone.quaternion.copy(root.quaternion);
283
- rootBone.scale.copy(root.scale);
284
- scene.nodeCount++;
285
- rootBone.name = "bone_" + root.name + scene.nodeCount.toString();
286
- if (!scene.nodeToBoneMap[root.name])
287
- scene.nodeToBoneMap[root.name] = [];
288
- scene.nodeToBoneMap[root.name].push(rootBone);
289
- for (let i in root.children) {
290
- var child = cloneTreeToBones(root.children[i], scene);
291
- rootBone.add(child);
292
- }
293
- return rootBone;
294
- }
295
- function sortWeights(indexes, weights) {
296
- var pairs = [];
297
- for (let i = 0; i < indexes.length; i++) {
298
- pairs.push({
299
- i: indexes[i],
300
- w: weights[i]
301
- });
302
- }
303
- pairs.sort(function(a, b) {
304
- return b.w - a.w;
305
- });
306
- while (pairs.length < 4) {
307
- pairs.push({
308
- i: 0,
309
- w: 0
310
- });
311
- }
312
- if (pairs.length > 4)
313
- pairs.length = 4;
314
- var sum = 0;
315
- for (let i = 0; i < 4; i++) {
316
- sum += pairs[i].w * pairs[i].w;
317
- }
318
- sum = Math.sqrt(sum);
319
- for (let i = 0; i < 4; i++) {
320
- pairs[i].w = pairs[i].w / sum;
321
- indexes[i] = pairs[i].i;
322
- weights[i] = pairs[i].w;
323
- }
324
- }
325
- function findMatchingBone(root, name) {
326
- if (root.name.indexOf("bone_" + name) == 0)
327
- return root;
328
- for (let i in root.children) {
329
- var ret = findMatchingBone(root.children[i], name);
330
- if (ret)
331
- return ret;
332
- }
333
- return void 0;
334
- }
335
- class aiMesh {
336
- constructor() {
337
- this.mPrimitiveTypes = 0;
338
- this.mNumVertices = 0;
339
- this.mNumFaces = 0;
340
- this.mNumBones = 0;
341
- this.mMaterialIndex = 0;
342
- this.mVertices = [];
343
- this.mNormals = [];
344
- this.mTangents = [];
345
- this.mBitangents = [];
346
- this.mColors = [[]];
347
- this.mTextureCoords = [[]];
348
- this.mFaces = [];
349
- this.mBones = [];
350
- this.hookupSkeletons = function(scene) {
351
- if (this.mBones.length == 0)
352
- return;
353
- var allBones = [];
354
- var offsetMatrix = [];
355
- var skeletonRoot = scene.findNode(this.mBones[0].mName);
356
- while (skeletonRoot.mParent && skeletonRoot.mParent.isBone) {
357
- skeletonRoot = skeletonRoot.mParent;
358
- }
359
- var threeSkeletonRoot = skeletonRoot.toTHREE(scene);
360
- var threeSkeletonRootBone = cloneTreeToBones(threeSkeletonRoot, scene);
361
- this.threeNode.add(threeSkeletonRootBone);
362
- for (let i = 0; i < this.mBones.length; i++) {
363
- var bone = findMatchingBone(threeSkeletonRootBone, this.mBones[i].mName);
364
- if (bone) {
365
- var tbone = bone;
366
- allBones.push(tbone);
367
- offsetMatrix.push(this.mBones[i].mOffsetMatrix.toTHREE());
368
- } else {
369
- var skeletonRoot = scene.findNode(this.mBones[i].mName);
370
- if (!skeletonRoot)
371
- return;
372
- var threeSkeletonRoot = skeletonRoot.toTHREE(scene);
373
- var threeSkeletonRootBone = cloneTreeToBones(threeSkeletonRoot, scene);
374
- this.threeNode.add(threeSkeletonRootBone);
375
- var bone = findMatchingBone(threeSkeletonRootBone, this.mBones[i].mName);
376
- var tbone = bone;
377
- allBones.push(tbone);
378
- offsetMatrix.push(this.mBones[i].mOffsetMatrix.toTHREE());
379
- }
380
- }
381
- var skeleton = new THREE.Skeleton(allBones, offsetMatrix);
382
- this.threeNode.bind(skeleton, new THREE.Matrix4());
383
- this.threeNode.material.skinning = true;
384
- };
385
- this.toTHREE = function(scene) {
386
- if (this.threeNode)
387
- return this.threeNode;
388
- var geometry = new THREE.BufferGeometry();
389
- var mat;
390
- if (scene.mMaterials[this.mMaterialIndex])
391
- mat = scene.mMaterials[this.mMaterialIndex].toTHREE(scene);
392
- else
393
- mat = new THREE.MeshLambertMaterial();
394
- geometry.setIndex(new THREE.BufferAttribute(new Uint32Array(this.mIndexArray), 1));
395
- geometry.setAttribute("position", new THREE.BufferAttribute(this.mVertexBuffer, 3));
396
- if (this.mNormalBuffer && this.mNormalBuffer.length > 0) {
397
- geometry.setAttribute("normal", new THREE.BufferAttribute(this.mNormalBuffer, 3));
398
- }
399
- if (this.mColorBuffer && this.mColorBuffer.length > 0) {
400
- geometry.setAttribute("color", new THREE.BufferAttribute(this.mColorBuffer, 4));
401
- }
402
- if (this.mTexCoordsBuffers[0] && this.mTexCoordsBuffers[0].length > 0) {
403
- geometry.setAttribute("uv", new THREE.BufferAttribute(new Float32Array(this.mTexCoordsBuffers[0]), 2));
404
- }
405
- if (this.mTexCoordsBuffers[1] && this.mTexCoordsBuffers[1].length > 0) {
406
- geometry.setAttribute("uv1", new THREE.BufferAttribute(new Float32Array(this.mTexCoordsBuffers[1]), 2));
407
- }
408
- if (this.mTangentBuffer && this.mTangentBuffer.length > 0) {
409
- geometry.setAttribute("tangents", new THREE.BufferAttribute(this.mTangentBuffer, 3));
410
- }
411
- if (this.mBitangentBuffer && this.mBitangentBuffer.length > 0) {
412
- geometry.setAttribute("bitangents", new THREE.BufferAttribute(this.mBitangentBuffer, 3));
413
- }
414
- if (this.mBones.length > 0) {
415
- var weights = [];
416
- var bones = [];
417
- for (let i = 0; i < this.mBones.length; i++) {
418
- for (let j = 0; j < this.mBones[i].mWeights.length; j++) {
419
- var weight = this.mBones[i].mWeights[j];
420
- if (weight) {
421
- if (!weights[weight.mVertexId])
422
- weights[weight.mVertexId] = [];
423
- if (!bones[weight.mVertexId])
424
- bones[weight.mVertexId] = [];
425
- weights[weight.mVertexId].push(weight.mWeight);
426
- bones[weight.mVertexId].push(parseInt(i));
427
- }
428
- }
429
- }
430
- for (let i in bones) {
431
- sortWeights(bones[i], weights[i]);
432
- }
433
- var _weights = [];
434
- var _bones = [];
435
- for (let i = 0; i < weights.length; i++) {
436
- for (let j = 0; j < 4; j++) {
437
- if (weights[i] && bones[i]) {
438
- _weights.push(weights[i][j]);
439
- _bones.push(bones[i][j]);
440
- } else {
441
- _weights.push(0);
442
- _bones.push(0);
443
- }
444
- }
445
- }
446
- geometry.setAttribute("skinWeight", new THREE.BufferAttribute(new Float32Array(_weights), BONESPERVERT));
447
- geometry.setAttribute("skinIndex", new THREE.BufferAttribute(new Float32Array(_bones), BONESPERVERT));
448
- }
449
- var mesh;
450
- if (this.mBones.length == 0)
451
- mesh = new THREE.Mesh(geometry, mat);
452
- if (this.mBones.length > 0) {
453
- mesh = new THREE.SkinnedMesh(geometry, mat);
454
- mesh.normalizeSkinWeights();
455
- }
456
- this.threeNode = mesh;
457
- return mesh;
458
- };
459
- }
460
- }
461
- class aiFace {
462
- constructor() {
463
- this.mNumIndices = 0;
464
- this.mIndices = [];
465
- }
466
- }
467
- class aiVector3D {
468
- constructor() {
469
- this.x = 0;
470
- this.y = 0;
471
- this.z = 0;
472
- this.toTHREE = function() {
473
- return new THREE.Vector3(this.x, this.y, this.z);
474
- };
475
- }
476
- }
477
- class aiColor3D {
478
- constructor() {
479
- this.r = 0;
480
- this.g = 0;
481
- this.b = 0;
482
- this.a = 0;
483
- this.toTHREE = function() {
484
- return new THREE.Color(this.r, this.g, this.b);
485
- };
486
- }
487
- }
488
- class aiQuaternion {
489
- constructor() {
490
- this.x = 0;
491
- this.y = 0;
492
- this.z = 0;
493
- this.w = 0;
494
- this.toTHREE = function() {
495
- return new THREE.Quaternion(this.x, this.y, this.z, this.w);
496
- };
497
- }
498
- }
499
- class aiVertexWeight {
500
- constructor() {
501
- this.mVertexId = 0;
502
- this.mWeight = 0;
503
- }
504
- }
505
- class aiString {
506
- constructor() {
507
- this.data = [];
508
- this.toString = function() {
509
- var str = "";
510
- this.data.forEach(function(i) {
511
- str += String.fromCharCode(i);
512
- });
513
- return str.replace(/[^\x20-\x7E]+/g, "");
514
- };
515
- }
516
- }
517
- class aiVectorKey {
518
- constructor() {
519
- this.mTime = 0;
520
- this.mValue = null;
521
- }
522
- }
523
- class aiQuatKey {
524
- constructor() {
525
- this.mTime = 0;
526
- this.mValue = null;
527
- }
528
- }
529
- class aiNode {
530
- constructor() {
531
- this.mName = "";
532
- this.mTransformation = [];
533
- this.mNumChildren = 0;
534
- this.mNumMeshes = 0;
535
- this.mMeshes = [];
536
- this.mChildren = [];
537
- this.toTHREE = function(scene) {
538
- if (this.threeNode)
539
- return this.threeNode;
540
- var o = new THREE.Object3D();
541
- o.name = this.mName;
542
- o.matrix = this.mTransformation.toTHREE();
543
- for (let i = 0; i < this.mChildren.length; i++) {
544
- o.add(this.mChildren[i].toTHREE(scene));
545
- }
546
- for (let i = 0; i < this.mMeshes.length; i++) {
547
- o.add(scene.mMeshes[this.mMeshes[i]].toTHREE(scene));
548
- }
549
- this.threeNode = o;
550
- o.matrix.decompose(o.position, o.quaternion, o.scale);
551
- return o;
552
- };
553
- }
554
- }
555
- class aiBone {
556
- constructor() {
557
- this.mName = "";
558
- this.mNumWeights = 0;
559
- this.mOffsetMatrix = 0;
560
- }
561
- }
562
- class aiMaterialProperty {
563
- constructor() {
564
- this.mKey = "";
565
- this.mSemantic = 0;
566
- this.mIndex = 0;
567
- this.mData = [];
568
- this.mDataLength = 0;
569
- this.mType = 0;
570
- this.dataAsColor = function() {
571
- var array = new Uint8Array(this.mData).buffer;
572
- var reader = new DataView(array);
573
- var r = reader.getFloat32(0, true);
574
- var g = reader.getFloat32(4, true);
575
- var b = reader.getFloat32(8, true);
576
- return new THREE.Color(r, g, b);
577
- };
578
- this.dataAsFloat = function() {
579
- var array = new Uint8Array(this.mData).buffer;
580
- var reader = new DataView(array);
581
- var r = reader.getFloat32(0, true);
582
- return r;
583
- };
584
- this.dataAsBool = function() {
585
- var array = new Uint8Array(this.mData).buffer;
586
- var reader = new DataView(array);
587
- var r = reader.getFloat32(0, true);
588
- return !!r;
589
- };
590
- this.dataAsString = function() {
591
- var s = new aiString();
592
- s.data = this.mData;
593
- return s.toString();
594
- };
595
- this.dataAsMap = function() {
596
- var s = new aiString();
597
- s.data = this.mData;
598
- var path2 = s.toString();
599
- path2 = path2.replace(/\\/g, "/");
600
- if (path2.indexOf("/") != -1) {
601
- path2 = path2.substr(path2.lastIndexOf("/") + 1);
602
- }
603
- return textureLoader.load(path2);
604
- };
605
- }
606
- }
607
- var namePropMapping = {
608
- "?mat.name": "name",
609
- "$mat.shadingm": "shading",
610
- "$mat.twosided": "twoSided",
611
- "$mat.wireframe": "wireframe",
612
- "$clr.ambient": "ambient",
613
- "$clr.diffuse": "color",
614
- "$clr.specular": "specular",
615
- "$clr.emissive": "emissive",
616
- "$clr.transparent": "transparent",
617
- "$clr.reflective": "reflect",
618
- "$mat.shininess": "shininess",
619
- "$mat.reflectivity": "reflectivity",
620
- "$mat.refracti": "refraction",
621
- "$tex.file": "map"
622
- };
623
- var nameTypeMapping = {
624
- "?mat.name": "string",
625
- "$mat.shadingm": "bool",
626
- "$mat.twosided": "bool",
627
- "$mat.wireframe": "bool",
628
- "$clr.ambient": "color",
629
- "$clr.diffuse": "color",
630
- "$clr.specular": "color",
631
- "$clr.emissive": "color",
632
- "$clr.transparent": "color",
633
- "$clr.reflective": "color",
634
- "$mat.shininess": "float",
635
- "$mat.reflectivity": "float",
636
- "$mat.refracti": "float",
637
- "$tex.file": "map"
638
- };
639
- class aiMaterial {
640
- constructor() {
641
- this.mNumAllocated = 0;
642
- this.mNumProperties = 0;
643
- this.mProperties = [];
644
- this.toTHREE = function() {
645
- var mat = new THREE.MeshPhongMaterial();
646
- for (let i = 0; i < this.mProperties.length; i++) {
647
- if (nameTypeMapping[this.mProperties[i].mKey] == "float") {
648
- mat[namePropMapping[this.mProperties[i].mKey]] = this.mProperties[i].dataAsFloat();
649
- }
650
- if (nameTypeMapping[this.mProperties[i].mKey] == "color") {
651
- mat[namePropMapping[this.mProperties[i].mKey]] = this.mProperties[i].dataAsColor();
652
- }
653
- if (nameTypeMapping[this.mProperties[i].mKey] == "bool") {
654
- mat[namePropMapping[this.mProperties[i].mKey]] = this.mProperties[i].dataAsBool();
655
- }
656
- if (nameTypeMapping[this.mProperties[i].mKey] == "string") {
657
- mat[namePropMapping[this.mProperties[i].mKey]] = this.mProperties[i].dataAsString();
658
- }
659
- if (nameTypeMapping[this.mProperties[i].mKey] == "map") {
660
- var prop = this.mProperties[i];
661
- if (prop.mSemantic == aiTextureType_DIFFUSE)
662
- mat.map = this.mProperties[i].dataAsMap();
663
- if (prop.mSemantic == aiTextureType_NORMALS)
664
- mat.normalMap = this.mProperties[i].dataAsMap();
665
- if (prop.mSemantic == aiTextureType_LIGHTMAP)
666
- mat.lightMap = this.mProperties[i].dataAsMap();
667
- if (prop.mSemantic == aiTextureType_OPACITY)
668
- mat.alphaMap = this.mProperties[i].dataAsMap();
669
- }
670
- }
671
- mat.ambient.r = 0.53;
672
- mat.ambient.g = 0.53;
673
- mat.ambient.b = 0.53;
674
- mat.color.r = 1;
675
- mat.color.g = 1;
676
- mat.color.b = 1;
677
- return mat;
678
- };
679
- }
680
- }
681
- function veclerp(v1, v2, l) {
682
- var v = new THREE.Vector3();
683
- var lm1 = 1 - l;
684
- v.x = v1.x * l + v2.x * lm1;
685
- v.y = v1.y * l + v2.y * lm1;
686
- v.z = v1.z * l + v2.z * lm1;
687
- return v;
688
- }
689
- function quatlerp(q1, q2, l) {
690
- return q1.clone().slerp(q2, 1 - l);
691
- }
692
- function sampleTrack(keys, time, lne, lerp) {
693
- if (keys.length == 1)
694
- return keys[0].mValue.toTHREE();
695
- var dist = Infinity;
696
- var key = null;
697
- var nextKey = null;
698
- for (let i = 0; i < keys.length; i++) {
699
- var timeDist = Math.abs(keys[i].mTime - time);
700
- if (timeDist < dist && keys[i].mTime <= time) {
701
- dist = timeDist;
702
- key = keys[i];
703
- nextKey = keys[i + 1];
704
- }
705
- }
706
- if (!key) {
707
- return null;
708
- } else if (nextKey) {
709
- var dT = nextKey.mTime - key.mTime;
710
- var T = key.mTime - time;
711
- var l = T / dT;
712
- return lerp(key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l);
713
- } else {
714
- nextKey = keys[0].clone();
715
- nextKey.mTime += lne;
716
- var dT = nextKey.mTime - key.mTime;
717
- var T = key.mTime - time;
718
- var l = T / dT;
719
- return lerp(key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l);
720
- }
721
- }
722
- class aiNodeAnim {
723
- constructor() {
724
- this.mNodeName = "";
725
- this.mNumPositionKeys = 0;
726
- this.mNumRotationKeys = 0;
727
- this.mNumScalingKeys = 0;
728
- this.mPositionKeys = [];
729
- this.mRotationKeys = [];
730
- this.mScalingKeys = [];
731
- this.mPreState = "";
732
- this.mPostState = "";
733
- this.init = function(tps) {
734
- if (!tps)
735
- tps = 1;
736
- function t(t2) {
737
- t2.mTime /= tps;
738
- }
739
- this.mPositionKeys.forEach(t);
740
- this.mRotationKeys.forEach(t);
741
- this.mScalingKeys.forEach(t);
742
- };
743
- this.sortKeys = function() {
744
- function comp(a, b) {
745
- return a.mTime - b.mTime;
746
- }
747
- this.mPositionKeys.sort(comp);
748
- this.mRotationKeys.sort(comp);
749
- this.mScalingKeys.sort(comp);
750
- };
751
- this.getLength = function() {
752
- return Math.max(
753
- Math.max.apply(
754
- null,
755
- this.mPositionKeys.map(function(a) {
756
- return a.mTime;
757
- })
758
- ),
759
- Math.max.apply(
760
- null,
761
- this.mRotationKeys.map(function(a) {
762
- return a.mTime;
763
- })
764
- ),
765
- Math.max.apply(
766
- null,
767
- this.mScalingKeys.map(function(a) {
768
- return a.mTime;
769
- })
770
- )
771
- );
772
- };
773
- this.toTHREE = function(o) {
774
- this.sortKeys();
775
- var length = this.getLength();
776
- var track = new Virtulous.KeyFrameTrack();
777
- for (let i = 0; i < length; i += 0.05) {
778
- var matrix = new THREE.Matrix4();
779
- var time = i;
780
- var pos = sampleTrack(this.mPositionKeys, time, length, veclerp);
781
- var scale = sampleTrack(this.mScalingKeys, time, length, veclerp);
782
- var rotation = sampleTrack(this.mRotationKeys, time, length, quatlerp);
783
- matrix.compose(pos, rotation, scale);
784
- var key = new Virtulous.KeyFrame(time, matrix);
785
- track.addKey(key);
786
- }
787
- track.target = o.findNode(this.mNodeName).toTHREE();
788
- var tracks = [track];
789
- if (o.nodeToBoneMap[this.mNodeName]) {
790
- for (let i = 0; i < o.nodeToBoneMap[this.mNodeName].length; i++) {
791
- var t2 = track.clone();
792
- t2.target = o.nodeToBoneMap[this.mNodeName][i];
793
- tracks.push(t2);
794
- }
795
- }
796
- return tracks;
797
- };
798
- }
799
- }
800
- class aiAnimation {
801
- constructor() {
802
- this.mName = "";
803
- this.mDuration = 0;
804
- this.mTicksPerSecond = 0;
805
- this.mNumChannels = 0;
806
- this.mChannels = [];
807
- this.toTHREE = function(root) {
808
- var animationHandle = new Virtulous.Animation();
809
- for (let i in this.mChannels) {
810
- this.mChannels[i].init(this.mTicksPerSecond);
811
- var tracks = this.mChannels[i].toTHREE(root);
812
- for (let j in tracks) {
813
- tracks[j].init();
814
- animationHandle.addTrack(tracks[j]);
815
- }
816
- }
817
- animationHandle.length = Math.max.apply(
818
- null,
819
- animationHandle.tracks.map(function(e) {
820
- return e.length;
821
- })
822
- );
823
- return animationHandle;
824
- };
825
- }
826
- }
827
- class aiTexture {
828
- constructor() {
829
- this.mWidth = 0;
830
- this.mHeight = 0;
831
- this.texAchFormatHint = [];
832
- this.pcData = [];
833
- }
834
- }
835
- class aiLight {
836
- constructor() {
837
- this.mName = "";
838
- this.mType = 0;
839
- this.mAttenuationConstant = 0;
840
- this.mAttenuationLinear = 0;
841
- this.mAttenuationQuadratic = 0;
842
- this.mAngleInnerCone = 0;
843
- this.mAngleOuterCone = 0;
844
- this.mColorDiffuse = null;
845
- this.mColorSpecular = null;
846
- this.mColorAmbient = null;
847
- }
848
- }
849
- class aiCamera {
850
- constructor() {
851
- this.mName = "";
852
- this.mPosition = null;
853
- this.mLookAt = null;
854
- this.mUp = null;
855
- this.mHorizontalFOV = 0;
856
- this.mClipPlaneNear = 0;
857
- this.mClipPlaneFar = 0;
858
- this.mAspect = 0;
859
- }
860
- }
861
- class aiScene {
862
- constructor() {
863
- this.versionMajor = 0;
864
- this.versionMinor = 0;
865
- this.versionRevision = 0;
866
- this.compileFlags = 0;
867
- this.mFlags = 0;
868
- this.mNumMeshes = 0;
869
- this.mNumMaterials = 0;
870
- this.mNumAnimations = 0;
871
- this.mNumTextures = 0;
872
- this.mNumLights = 0;
873
- this.mNumCameras = 0;
874
- this.mRootNode = null;
875
- this.mMeshes = [];
876
- this.mMaterials = [];
877
- this.mAnimations = [];
878
- this.mLights = [];
879
- this.mCameras = [];
880
- this.nodeToBoneMap = {};
881
- this.findNode = function(name, root) {
882
- if (!root) {
883
- root = this.mRootNode;
884
- }
885
- if (root.mName == name) {
886
- return root;
887
- }
888
- for (let i = 0; i < root.mChildren.length; i++) {
889
- var ret = this.findNode(name, root.mChildren[i]);
890
- if (ret)
891
- return ret;
892
- }
893
- return null;
894
- };
895
- this.toTHREE = function() {
896
- this.nodeCount = 0;
897
- markBones(this);
898
- var o = this.mRootNode.toTHREE(this);
899
- for (let i in this.mMeshes)
900
- this.mMeshes[i].hookupSkeletons(this);
901
- if (this.mAnimations.length > 0) {
902
- var a = this.mAnimations[0].toTHREE(this);
903
- }
904
- return { object: o, animation: a };
905
- };
906
- }
907
- }
908
- class aiMatrix4 {
909
- constructor() {
910
- this.elements = [[], [], [], []];
911
- this.toTHREE = function() {
912
- var m = new THREE.Matrix4();
913
- for (let i = 0; i < 4; ++i) {
914
- for (let i2 = 0; i2 < 4; ++i2) {
915
- m.elements[i * 4 + i2] = this.elements[i2][i];
916
- }
917
- }
918
- return m;
919
- };
920
- }
921
- }
922
- var littleEndian = true;
923
- function readFloat(dataview) {
924
- var val = dataview.getFloat32(dataview.readOffset, littleEndian);
925
- dataview.readOffset += 4;
926
- return val;
927
- }
928
- function Read_double(dataview) {
929
- var val = dataview.getFloat64(dataview.readOffset, littleEndian);
930
- dataview.readOffset += 8;
931
- return val;
932
- }
933
- function Read_uint8_t(dataview) {
934
- var val = dataview.getUint8(dataview.readOffset);
935
- dataview.readOffset += 1;
936
- return val;
937
- }
938
- function Read_uint16_t(dataview) {
939
- var val = dataview.getUint16(dataview.readOffset, littleEndian);
940
- dataview.readOffset += 2;
941
- return val;
942
- }
943
- function Read_unsigned_int(dataview) {
944
- var val = dataview.getUint32(dataview.readOffset, littleEndian);
945
- dataview.readOffset += 4;
946
- return val;
947
- }
948
- function Read_uint32_t(dataview) {
949
- var val = dataview.getUint32(dataview.readOffset, littleEndian);
950
- dataview.readOffset += 4;
951
- return val;
952
- }
953
- function Read_aiVector3D(stream) {
954
- var v = new aiVector3D();
955
- v.x = readFloat(stream);
956
- v.y = readFloat(stream);
957
- v.z = readFloat(stream);
958
- return v;
959
- }
960
- function Read_aiColor3D(stream) {
961
- var c = new aiColor3D();
962
- c.r = readFloat(stream);
963
- c.g = readFloat(stream);
964
- c.b = readFloat(stream);
965
- return c;
966
- }
967
- function Read_aiQuaternion(stream) {
968
- var v = new aiQuaternion();
969
- v.w = readFloat(stream);
970
- v.x = readFloat(stream);
971
- v.y = readFloat(stream);
972
- v.z = readFloat(stream);
973
- return v;
974
- }
975
- function Read_aiString(stream) {
976
- var s = new aiString();
977
- var stringlengthbytes = Read_unsigned_int(stream);
978
- stream.ReadBytes(s.data, 1, stringlengthbytes);
979
- return s.toString();
980
- }
981
- function Read_aiVertexWeight(stream) {
982
- var w = new aiVertexWeight();
983
- w.mVertexId = Read_unsigned_int(stream);
984
- w.mWeight = readFloat(stream);
985
- return w;
986
- }
987
- function Read_aiMatrix4x4(stream) {
988
- var m = new aiMatrix4();
989
- for (let i = 0; i < 4; ++i) {
990
- for (let i2 = 0; i2 < 4; ++i2) {
991
- m.elements[i][i2] = readFloat(stream);
992
- }
993
- }
994
- return m;
995
- }
996
- function Read_aiVectorKey(stream) {
997
- var v = new aiVectorKey();
998
- v.mTime = Read_double(stream);
999
- v.mValue = Read_aiVector3D(stream);
1000
- return v;
1001
- }
1002
- function Read_aiQuatKey(stream) {
1003
- var v = new aiQuatKey();
1004
- v.mTime = Read_double(stream);
1005
- v.mValue = Read_aiQuaternion(stream);
1006
- return v;
1007
- }
1008
- function ReadArray_aiVertexWeight(stream, data, size) {
1009
- for (let i = 0; i < size; i++)
1010
- data[i] = Read_aiVertexWeight(stream);
1011
- }
1012
- function ReadArray_aiVectorKey(stream, data, size) {
1013
- for (let i = 0; i < size; i++)
1014
- data[i] = Read_aiVectorKey(stream);
1015
- }
1016
- function ReadArray_aiQuatKey(stream, data, size) {
1017
- for (let i = 0; i < size; i++)
1018
- data[i] = Read_aiQuatKey(stream);
1019
- }
1020
- function ReadBounds(stream, T, n) {
1021
- return stream.Seek(sizeof(T) * n, aiOrigin_CUR);
1022
- }
1023
- function ai_assert(bool) {
1024
- if (!bool)
1025
- throw "asset failed";
1026
- }
1027
- function ReadBinaryNode(stream, parent, depth) {
1028
- var chunkID = Read_uint32_t(stream);
1029
- ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
1030
- Read_uint32_t(stream);
1031
- var node = new aiNode();
1032
- node.mParent = parent;
1033
- node.mDepth = depth;
1034
- node.mName = Read_aiString(stream);
1035
- node.mTransformation = Read_aiMatrix4x4(stream);
1036
- node.mNumChildren = Read_unsigned_int(stream);
1037
- node.mNumMeshes = Read_unsigned_int(stream);
1038
- if (node.mNumMeshes) {
1039
- node.mMeshes = [];
1040
- for (let i = 0; i < node.mNumMeshes; ++i) {
1041
- node.mMeshes[i] = Read_unsigned_int(stream);
1042
- }
1043
- }
1044
- if (node.mNumChildren) {
1045
- node.mChildren = [];
1046
- for (let i = 0; i < node.mNumChildren; ++i) {
1047
- var node2 = ReadBinaryNode(stream, node, depth++);
1048
- node.mChildren[i] = node2;
1049
- }
1050
- }
1051
- return node;
1052
- }
1053
- function ReadBinaryBone(stream, b) {
1054
- var chunkID = Read_uint32_t(stream);
1055
- ai_assert(chunkID == ASSBIN_CHUNK_AIBONE);
1056
- Read_uint32_t(stream);
1057
- b.mName = Read_aiString(stream);
1058
- b.mNumWeights = Read_unsigned_int(stream);
1059
- b.mOffsetMatrix = Read_aiMatrix4x4(stream);
1060
- if (shortened) {
1061
- ReadBounds(stream, b.mWeights, b.mNumWeights);
1062
- } else {
1063
- b.mWeights = [];
1064
- ReadArray_aiVertexWeight(stream, b.mWeights, b.mNumWeights);
1065
- }
1066
- return b;
1067
- }
1068
- function ReadBinaryMesh(stream, mesh) {
1069
- var chunkID = Read_uint32_t(stream);
1070
- ai_assert(chunkID == ASSBIN_CHUNK_AIMESH);
1071
- Read_uint32_t(stream);
1072
- mesh.mPrimitiveTypes = Read_unsigned_int(stream);
1073
- mesh.mNumVertices = Read_unsigned_int(stream);
1074
- mesh.mNumFaces = Read_unsigned_int(stream);
1075
- mesh.mNumBones = Read_unsigned_int(stream);
1076
- mesh.mMaterialIndex = Read_unsigned_int(stream);
1077
- mesh.mNumUVComponents = [];
1078
- var c = Read_unsigned_int(stream);
1079
- if (c & ASSBIN_MESH_HAS_POSITIONS) {
1080
- if (shortened) {
1081
- ReadBounds(stream, mesh.mVertices, mesh.mNumVertices);
1082
- } else {
1083
- mesh.mVertices = [];
1084
- mesh.mVertexBuffer = stream.subArray32(stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4);
1085
- stream.Seek(mesh.mNumVertices * 3 * 4, aiOrigin_CUR);
1086
- }
1087
- }
1088
- if (c & ASSBIN_MESH_HAS_NORMALS) {
1089
- if (shortened) {
1090
- ReadBounds(stream, mesh.mNormals, mesh.mNumVertices);
1091
- } else {
1092
- mesh.mNormals = [];
1093
- mesh.mNormalBuffer = stream.subArray32(stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4);
1094
- stream.Seek(mesh.mNumVertices * 3 * 4, aiOrigin_CUR);
1095
- }
1096
- }
1097
- if (c & ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS) {
1098
- if (shortened) {
1099
- ReadBounds(stream, mesh.mTangents, mesh.mNumVertices);
1100
- ReadBounds(stream, mesh.mBitangents, mesh.mNumVertices);
1101
- } else {
1102
- mesh.mTangents = [];
1103
- mesh.mTangentBuffer = stream.subArray32(stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4);
1104
- stream.Seek(mesh.mNumVertices * 3 * 4, aiOrigin_CUR);
1105
- mesh.mBitangents = [];
1106
- mesh.mBitangentBuffer = stream.subArray32(stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4);
1107
- stream.Seek(mesh.mNumVertices * 3 * 4, aiOrigin_CUR);
1108
- }
1109
- }
1110
- for (let n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS; ++n) {
1111
- if (!(c & ASSBIN_MESH_HAS_COLOR(n)))
1112
- break;
1113
- if (shortened) {
1114
- ReadBounds(stream, mesh.mColors[n], mesh.mNumVertices);
1115
- } else {
1116
- mesh.mColors[n] = [];
1117
- mesh.mColorBuffer = stream.subArray32(stream.readOffset, stream.readOffset + mesh.mNumVertices * 4 * 4);
1118
- stream.Seek(mesh.mNumVertices * 4 * 4, aiOrigin_CUR);
1119
- }
1120
- }
1121
- mesh.mTexCoordsBuffers = [];
1122
- for (let n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++n) {
1123
- if (!(c & ASSBIN_MESH_HAS_TEXCOORD(n)))
1124
- break;
1125
- mesh.mNumUVComponents[n] = Read_unsigned_int(stream);
1126
- if (shortened) {
1127
- ReadBounds(stream, mesh.mTextureCoords[n], mesh.mNumVertices);
1128
- } else {
1129
- mesh.mTextureCoords[n] = [];
1130
- mesh.mTexCoordsBuffers[n] = [];
1131
- for (let uv = 0; uv < mesh.mNumVertices; uv++) {
1132
- mesh.mTexCoordsBuffers[n].push(readFloat(stream));
1133
- mesh.mTexCoordsBuffers[n].push(readFloat(stream));
1134
- readFloat(stream);
1135
- }
1136
- }
1137
- }
1138
- if (shortened) {
1139
- Read_unsigned_int(stream);
1140
- } else {
1141
- mesh.mFaces = [];
1142
- mesh.mIndexArray = [];
1143
- for (let i = 0; i < mesh.mNumFaces; ++i) {
1144
- var f = mesh.mFaces[i] = new aiFace();
1145
- f.mNumIndices = Read_uint16_t(stream);
1146
- f.mIndices = [];
1147
- for (let a = 0; a < f.mNumIndices; ++a) {
1148
- if (mesh.mNumVertices < 1 << 16) {
1149
- f.mIndices[a] = Read_uint16_t(stream);
1150
- } else {
1151
- f.mIndices[a] = Read_unsigned_int(stream);
1152
- }
1153
- }
1154
- if (f.mNumIndices === 3) {
1155
- mesh.mIndexArray.push(f.mIndices[0]);
1156
- mesh.mIndexArray.push(f.mIndices[1]);
1157
- mesh.mIndexArray.push(f.mIndices[2]);
1158
- } else if (f.mNumIndices === 4) {
1159
- mesh.mIndexArray.push(f.mIndices[0]);
1160
- mesh.mIndexArray.push(f.mIndices[1]);
1161
- mesh.mIndexArray.push(f.mIndices[2]);
1162
- mesh.mIndexArray.push(f.mIndices[2]);
1163
- mesh.mIndexArray.push(f.mIndices[3]);
1164
- mesh.mIndexArray.push(f.mIndices[0]);
1165
- } else {
1166
- throw new Error("Sorry, can't currently triangulate polys. Use the triangulate preprocessor in Assimp.");
1167
- }
1168
- }
1169
- }
1170
- if (mesh.mNumBones) {
1171
- mesh.mBones = [];
1172
- for (let a = 0; a < mesh.mNumBones; ++a) {
1173
- mesh.mBones[a] = new aiBone();
1174
- ReadBinaryBone(stream, mesh.mBones[a]);
1175
- }
1176
- }
1177
- }
1178
- function ReadBinaryMaterialProperty(stream, prop) {
1179
- var chunkID = Read_uint32_t(stream);
1180
- ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIALPROPERTY);
1181
- Read_uint32_t(stream);
1182
- prop.mKey = Read_aiString(stream);
1183
- prop.mSemantic = Read_unsigned_int(stream);
1184
- prop.mIndex = Read_unsigned_int(stream);
1185
- prop.mDataLength = Read_unsigned_int(stream);
1186
- prop.mType = Read_unsigned_int(stream);
1187
- prop.mData = [];
1188
- stream.ReadBytes(prop.mData, 1, prop.mDataLength);
1189
- }
1190
- function ReadBinaryMaterial(stream, mat) {
1191
- var chunkID = Read_uint32_t(stream);
1192
- ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIAL);
1193
- Read_uint32_t(stream);
1194
- mat.mNumAllocated = mat.mNumProperties = Read_unsigned_int(stream);
1195
- if (mat.mNumProperties) {
1196
- if (mat.mProperties) {
1197
- delete mat.mProperties;
1198
- }
1199
- mat.mProperties = [];
1200
- for (let i = 0; i < mat.mNumProperties; ++i) {
1201
- mat.mProperties[i] = new aiMaterialProperty();
1202
- ReadBinaryMaterialProperty(stream, mat.mProperties[i]);
1203
- }
1204
- }
1205
- }
1206
- function ReadBinaryNodeAnim(stream, nd) {
1207
- var chunkID = Read_uint32_t(stream);
1208
- ai_assert(chunkID == ASSBIN_CHUNK_AINODEANIM);
1209
- Read_uint32_t(stream);
1210
- nd.mNodeName = Read_aiString(stream);
1211
- nd.mNumPositionKeys = Read_unsigned_int(stream);
1212
- nd.mNumRotationKeys = Read_unsigned_int(stream);
1213
- nd.mNumScalingKeys = Read_unsigned_int(stream);
1214
- nd.mPreState = Read_unsigned_int(stream);
1215
- nd.mPostState = Read_unsigned_int(stream);
1216
- if (nd.mNumPositionKeys) {
1217
- if (shortened) {
1218
- ReadBounds(stream, nd.mPositionKeys, nd.mNumPositionKeys);
1219
- } else {
1220
- nd.mPositionKeys = [];
1221
- ReadArray_aiVectorKey(stream, nd.mPositionKeys, nd.mNumPositionKeys);
1222
- }
1223
- }
1224
- if (nd.mNumRotationKeys) {
1225
- if (shortened) {
1226
- ReadBounds(stream, nd.mRotationKeys, nd.mNumRotationKeys);
1227
- } else {
1228
- nd.mRotationKeys = [];
1229
- ReadArray_aiQuatKey(stream, nd.mRotationKeys, nd.mNumRotationKeys);
1230
- }
1231
- }
1232
- if (nd.mNumScalingKeys) {
1233
- if (shortened) {
1234
- ReadBounds(stream, nd.mScalingKeys, nd.mNumScalingKeys);
1235
- } else {
1236
- nd.mScalingKeys = [];
1237
- ReadArray_aiVectorKey(stream, nd.mScalingKeys, nd.mNumScalingKeys);
1238
- }
1239
- }
1240
- }
1241
- function ReadBinaryAnim(stream, anim) {
1242
- var chunkID = Read_uint32_t(stream);
1243
- ai_assert(chunkID == ASSBIN_CHUNK_AIANIMATION);
1244
- Read_uint32_t(stream);
1245
- anim.mName = Read_aiString(stream);
1246
- anim.mDuration = Read_double(stream);
1247
- anim.mTicksPerSecond = Read_double(stream);
1248
- anim.mNumChannels = Read_unsigned_int(stream);
1249
- if (anim.mNumChannels) {
1250
- anim.mChannels = [];
1251
- for (let a = 0; a < anim.mNumChannels; ++a) {
1252
- anim.mChannels[a] = new aiNodeAnim();
1253
- ReadBinaryNodeAnim(stream, anim.mChannels[a]);
1254
- }
1255
- }
1256
- }
1257
- function ReadBinaryTexture(stream, tex) {
1258
- var chunkID = Read_uint32_t(stream);
1259
- ai_assert(chunkID == ASSBIN_CHUNK_AITEXTURE);
1260
- Read_uint32_t(stream);
1261
- tex.mWidth = Read_unsigned_int(stream);
1262
- tex.mHeight = Read_unsigned_int(stream);
1263
- stream.ReadBytes(tex.achFormatHint, 1, 4);
1264
- if (!shortened) {
1265
- if (!tex.mHeight) {
1266
- tex.pcData = [];
1267
- stream.ReadBytes(tex.pcData, 1, tex.mWidth);
1268
- } else {
1269
- tex.pcData = [];
1270
- stream.ReadBytes(tex.pcData, 1, tex.mWidth * tex.mHeight * 4);
1271
- }
1272
- }
1273
- }
1274
- function ReadBinaryLight(stream, l) {
1275
- var chunkID = Read_uint32_t(stream);
1276
- ai_assert(chunkID == ASSBIN_CHUNK_AILIGHT);
1277
- Read_uint32_t(stream);
1278
- l.mName = Read_aiString(stream);
1279
- l.mType = Read_unsigned_int(stream);
1280
- if (l.mType != aiLightSource_DIRECTIONAL) {
1281
- l.mAttenuationConstant = readFloat(stream);
1282
- l.mAttenuationLinear = readFloat(stream);
1283
- l.mAttenuationQuadratic = readFloat(stream);
1284
- }
1285
- l.mColorDiffuse = Read_aiColor3D(stream);
1286
- l.mColorSpecular = Read_aiColor3D(stream);
1287
- l.mColorAmbient = Read_aiColor3D(stream);
1288
- if (l.mType == aiLightSource_SPOT) {
1289
- l.mAngleInnerCone = readFloat(stream);
1290
- l.mAngleOuterCone = readFloat(stream);
1291
- }
1292
- }
1293
- function ReadBinaryCamera(stream, cam) {
1294
- var chunkID = Read_uint32_t(stream);
1295
- ai_assert(chunkID == ASSBIN_CHUNK_AICAMERA);
1296
- Read_uint32_t(stream);
1297
- cam.mName = Read_aiString(stream);
1298
- cam.mPosition = Read_aiVector3D(stream);
1299
- cam.mLookAt = Read_aiVector3D(stream);
1300
- cam.mUp = Read_aiVector3D(stream);
1301
- cam.mHorizontalFOV = readFloat(stream);
1302
- cam.mClipPlaneNear = readFloat(stream);
1303
- cam.mClipPlaneFar = readFloat(stream);
1304
- cam.mAspect = readFloat(stream);
1305
- }
1306
- function ReadBinaryScene(stream, scene) {
1307
- var chunkID = Read_uint32_t(stream);
1308
- ai_assert(chunkID == ASSBIN_CHUNK_AISCENE);
1309
- Read_uint32_t(stream);
1310
- scene.mFlags = Read_unsigned_int(stream);
1311
- scene.mNumMeshes = Read_unsigned_int(stream);
1312
- scene.mNumMaterials = Read_unsigned_int(stream);
1313
- scene.mNumAnimations = Read_unsigned_int(stream);
1314
- scene.mNumTextures = Read_unsigned_int(stream);
1315
- scene.mNumLights = Read_unsigned_int(stream);
1316
- scene.mNumCameras = Read_unsigned_int(stream);
1317
- scene.mRootNode = new aiNode();
1318
- scene.mRootNode = ReadBinaryNode(stream, null, 0);
1319
- if (scene.mNumMeshes) {
1320
- scene.mMeshes = [];
1321
- for (let i = 0; i < scene.mNumMeshes; ++i) {
1322
- scene.mMeshes[i] = new aiMesh();
1323
- ReadBinaryMesh(stream, scene.mMeshes[i]);
1324
- }
1325
- }
1326
- if (scene.mNumMaterials) {
1327
- scene.mMaterials = [];
1328
- for (let i = 0; i < scene.mNumMaterials; ++i) {
1329
- scene.mMaterials[i] = new aiMaterial();
1330
- ReadBinaryMaterial(stream, scene.mMaterials[i]);
1331
- }
1332
- }
1333
- if (scene.mNumAnimations) {
1334
- scene.mAnimations = [];
1335
- for (let i = 0; i < scene.mNumAnimations; ++i) {
1336
- scene.mAnimations[i] = new aiAnimation();
1337
- ReadBinaryAnim(stream, scene.mAnimations[i]);
1338
- }
1339
- }
1340
- if (scene.mNumTextures) {
1341
- scene.mTextures = [];
1342
- for (let i = 0; i < scene.mNumTextures; ++i) {
1343
- scene.mTextures[i] = new aiTexture();
1344
- ReadBinaryTexture(stream, scene.mTextures[i]);
1345
- }
1346
- }
1347
- if (scene.mNumLights) {
1348
- scene.mLights = [];
1349
- for (let i = 0; i < scene.mNumLights; ++i) {
1350
- scene.mLights[i] = new aiLight();
1351
- ReadBinaryLight(stream, scene.mLights[i]);
1352
- }
1353
- }
1354
- if (scene.mNumCameras) {
1355
- scene.mCameras = [];
1356
- for (let i = 0; i < scene.mNumCameras; ++i) {
1357
- scene.mCameras[i] = new aiCamera();
1358
- ReadBinaryCamera(stream, scene.mCameras[i]);
1359
- }
1360
- }
1361
- }
1362
- var aiOrigin_CUR = 0;
1363
- var aiOrigin_BEG = 1;
1364
- function extendStream(stream) {
1365
- stream.readOffset = 0;
1366
- stream.Seek = function(off, ori) {
1367
- if (ori == aiOrigin_CUR) {
1368
- stream.readOffset += off;
1369
- }
1370
- if (ori == aiOrigin_BEG) {
1371
- stream.readOffset = off;
1372
- }
1373
- };
1374
- stream.ReadBytes = function(buff, size, n) {
1375
- var bytes = size * n;
1376
- for (let i = 0; i < bytes; i++)
1377
- buff[i] = Read_uint8_t(this);
1378
- };
1379
- stream.subArray32 = function(start, end) {
1380
- var buff = this.buffer;
1381
- var newbuff = buff.slice(start, end);
1382
- return new Float32Array(newbuff);
1383
- };
1384
- stream.subArrayUint16 = function(start, end) {
1385
- var buff = this.buffer;
1386
- var newbuff = buff.slice(start, end);
1387
- return new Uint16Array(newbuff);
1388
- };
1389
- stream.subArrayUint8 = function(start, end) {
1390
- var buff = this.buffer;
1391
- var newbuff = buff.slice(start, end);
1392
- return new Uint8Array(newbuff);
1393
- };
1394
- stream.subArrayUint32 = function(start, end) {
1395
- var buff = this.buffer;
1396
- var newbuff = buff.slice(start, end);
1397
- return new Uint32Array(newbuff);
1398
- };
1399
- }
1400
- var shortened, compressed;
1401
- function InternReadFile(pFiledata) {
1402
- var pScene = new aiScene();
1403
- var stream = new DataView(pFiledata);
1404
- extendStream(stream);
1405
- stream.Seek(44, aiOrigin_CUR);
1406
- pScene.versionMajor = Read_unsigned_int(stream);
1407
- pScene.versionMinor = Read_unsigned_int(stream);
1408
- pScene.versionRevision = Read_unsigned_int(stream);
1409
- pScene.compileFlags = Read_unsigned_int(stream);
1410
- shortened = Read_uint16_t(stream) > 0;
1411
- compressed = Read_uint16_t(stream) > 0;
1412
- if (shortened)
1413
- throw "Shortened binaries are not supported!";
1414
- stream.Seek(256, aiOrigin_CUR);
1415
- stream.Seek(128, aiOrigin_CUR);
1416
- stream.Seek(64, aiOrigin_CUR);
1417
- if (compressed) {
1418
- var uncompressedSize = Read_uint32_t(stream);
1419
- var compressedSize = stream.FileSize() - stream.Tell();
1420
- var compressedData = [];
1421
- stream.Read(compressedData, 1, compressedSize);
1422
- var uncompressedData = [];
1423
- uncompress(uncompressedData, uncompressedSize, compressedData, compressedSize);
1424
- var buff = new ArrayBuffer(uncompressedData);
1425
- ReadBinaryScene(buff, pScene);
1426
- } else {
1427
- ReadBinaryScene(stream, pScene);
1428
- }
1429
- return pScene.toTHREE();
1430
- }
1431
- return InternReadFile(buffer);
1432
- }
1433
- }
1434
- exports.AssimpLoader = AssimpLoader;