Loader

MMDLoader

A loader for MMD resources.

MMDLoader creates Verge3D Objects from MMD resources as PMD, PMX, VMD, and VPD files. See MMDAnimationHelper for MMD animation handling as IK, Grant, and Physics.

If you want raw content of MMD resources, use .loadPMD/PMX/VMD/VPD methods.

Example

// Instantiate a loader var loader = new v3d.MMDLoader(); // Load a MMD model loader.load( // path to PMD/PMX file 'models/mmd/miku.pmd', // called when the resource is loaded function(mesh) { scene.add(mesh); }, // called when loading is in progresses function(xhr) { console.log((xhr.loaded / xhr.total * 100) + '% loaded'); }, // called when loading has errors function(error) { console.log('An error happened'); } ); webgl_loader_mmd
webgl_loader_mmd_pose
webgl_loader_mmd_audio


Constructor

MMDLoader(manager : LoadingManager)

manager — The loadingManager for the loader to use. Default is v3d.DefaultLoadingManager.

Creates a new MMDLoader.

Properties

Methods

.load (url : String, onLoad : Function, onProgress : Function, onError : Function) : null

url — A string containing the path/URL of the .pmd or .pmx file.
onLoad — A function to be called after the loading is successfully completed.
onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .total and .loaded bytes.
onError — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.

Begin loading PMD/PMX model file from url and fire the callback function with the parsed SkinnedMesh containing BufferGeometry and an array of MeshToonMaterial.

.loadAnimation (url : String, object : Object3D, onLoad : Function, onProgress : Function, onError : Function) : null

url — A string or an array of string containing the path/URL of the .vmd file(s).If two or more files are specified, they'll be merged.
objectSkinnedMesh or Camera. Clip and its tacks will be fitting to this object.
onLoad — A function to be called after the loading is successfully completed.
onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .total and .loaded bytes.
onError — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.

Begin loading VMD motion file(s) from url(s) and fire the callback function with the parsed AnimatioinClip.

.loadWithAnimation (modelUrl : String, vmdUrl : String, onLoad : Function, onProgress : Function, onError : Function) : null

modelUrl — A string containing the path/URL of the .pmd or .pmx file.
vmdUrl — A string or an array of string containing the path/URL of the .vmd file(s).
onLoad — A function to be called after the loading is successfully completed.
onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .total and .loaded bytes.
onError — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.

Begin loading PMD/PMX model file and VMD motion file(s) from urls and fire the callback function with an Object containing parsed SkinnedMesh and AnimationClip fitting to the SkinnedMesh.

.setCrossOrigin (crossOrigin : String) : MMDLoader

crossOrigin — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.

Source

For more info on how to obtain the source code of this module see this page.