MMDLoader.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Loader] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc"> A loader for <a href="http://www.geocities.jp/higuchuu4/index_e.htm"><em>MMD</em></a> resources. <br /><br />
  14. [name] creates Three.js Objects from MMD resources as PMD, PMX, VMD, and VPD files.
  15. See [page:MMDAnimationHelper] for MMD animation handling as IK, Grant, and Physics.<br /><br />
  16. If you want raw content of MMD resources, use .loadPMD/PMX/VMD/VPD methods.
  17. <h2>Example</h2>
  18. <code>
  19. // Instantiate a loader
  20. var loader = new THREE.MMDLoader();
  21. // Load a MMD model
  22. loader.load(
  23. // path to PMD/PMX file
  24. 'models/mmd/miku.pmd',
  25. // called when the resource is loaded
  26. function ( mesh ) {
  27. scene.add( mesh );
  28. },
  29. // called when loading is in progresses
  30. function ( xhr ) {
  31. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  32. },
  33. // called when loading has errors
  34. function ( error ) {
  35. console.log( 'An error happened' );
  36. }
  37. );
  38. </code>
  39. [example:webgl_loader_mmd]<br />
  40. [example:webgl_loader_mmd_pose]<br />
  41. [example:webgl_loader_mmd_audio]<br />
  42. <br />
  43. <hr>
  44. <h2>Constructor</h2>
  45. <h3>[name]( [param:LoadingManager manager] )</h3>
  46. <p>
  47. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  48. </p>
  49. <p>
  50. Creates a new [name].
  51. </p>
  52. <h2>Properties</h2>
  53. <h2>Methods</h2>
  54. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  55. <p>
  56. [page:String url] — A string containing the path/URL of the <em>.pmd</em> or <em>.pmx</em> file.<br />
  57. [page:Function onLoad] — A function to be called after the loading is successfully completed.<br />
  58. [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  59. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.<br />
  60. </p>
  61. <p>
  62. Begin loading PMD/PMX model file from url and fire the callback function with the parsed [page:SkinnedMesh] containing [page:BufferGeometry] and an array of [page:MeshToonMaterial].
  63. </p>
  64. <h3>[method:null loadAnimation]( [param:String url], [param:Object3D object], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  65. <p>
  66. [page:String url] — A string or an array of string containing the path/URL of the <em>.vmd</em> file(s).If two or more files are specified, they'll be merged.<br />
  67. [page:Object3D object] — [page:SkinnedMesh] or [page:Camera]. Clip and its tacks will be fitting to this object.<br />
  68. [page:Function onLoad] — A function to be called after the loading is successfully completed.<br />
  69. [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  70. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.<br />
  71. </p>
  72. <p>
  73. Begin loading VMD motion file(s) from url(s) and fire the callback function with the parsed [page:AnimatioinClip].
  74. </p>
  75. <h3>[method:null loadWithAnimation]( [param:String modelUrl], [param:String vmdUrl], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  76. <p>
  77. [page:String modelUrl] — A string containing the path/URL of the <em>.pmd</em> or <em>.pmx</em> file.<br />
  78. [page:String vmdUrl] — A string or an array of string containing the path/URL of the <em>.vmd</em> file(s).<br />
  79. [page:Function onLoad] — A function to be called after the loading is successfully completed.<br />
  80. [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  81. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.<br />
  82. </p>
  83. <p>
  84. Begin loading PMD/PMX model file and VMD motion file(s) from urls and fire the callback function with an [page:Object] containing parsed [page:SkinnedMesh] and [page:AnimationClip] fitting to the [page:SkinnedMesh].
  85. </p>
  86. <h3>[method:MMDLoader setCrossOrigin]( [param:String crossOrigin] )</h3>
  87. <p>
  88. [page:String crossOrigin] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
  89. </p>
  90. <h2>Source</h2>
  91. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/MMDLoader.js examples/js/loaders/MMDLoader.js]
  92. </body>
  93. </html>