three-stdlib 2.24.2 → 2.25.1

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