mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-30 01:14:57 +01:00
34 lines
726 B
JavaScript
34 lines
726 B
JavaScript
|
/**
|
||
|
* @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 );
|
||
|
|
||
|
}
|
||
|
};
|