By default, babylon.js comes with an importer for .babylon files.
You can also create your own importer by providing a specific object to the BABYLON.SceneLoader.RegisterPlugin
function.
This object must have three properties:
extensions
)importMesh
function to import specific meshesload
function to import complete sceneHere is a sample importer object:
BABYLON.SceneLoader.RegisterPlugin({
extensions: ".babylon",
importMesh: function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
return true;
},
load: function (scene, data, rootUrl) {
return true;
}
});
meshesNames
is the names of meshes to importscene
is the scene to load data intodata
is the string representation of the file to loadrootUrl
defines the root URL of your assetsmeshes
is the list of imported meshesparticleSystems
is the list of imported particle systemsskeletons
is the list of imported skeletons