Doodle3D-Slicer/three.js-master/examples/js/loaders/SVGLoader.js
2017-06-22 13:21:07 +02:00

34 lines
726 B
JavaScript
Executable File

/**
* @author mrdoob / http://mrdoob.com/
* @author zz85 / http://joshuakoo.com/
*/
THREE.SVGLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
THREE.SVGLoader.prototype = {
constructor: THREE.MaterialLoader,
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var parser = new DOMParser();
var loader = new THREE.XHRLoader( scope.manager );
loader.setCrossOrigin( this.crossOrigin );
loader.load( url, function ( svgString ) {
var doc = parser.parseFromString( svgString, 'image/svg+xml' ); // application/xml
onLoad( doc.firstChild );
}, onProgress, onError );
}
};