提交 ee7b6e92 编写于 作者: M Mr.doob

Added GeometryLoader placeholder.

上级 5e1af766
......@@ -37,8 +37,6 @@ THREE.BufferGeometryLoader.prototype = {
var geometry = new THREE.BufferGeometry();
var attributes = json.attributes;
var offsets = json.offsets;
var boundingSphere = json.boundingSphere;
for ( var key in attributes ) {
......@@ -51,12 +49,16 @@ THREE.BufferGeometryLoader.prototype = {
}
var offsets = json.offsets;
if ( offsets !== undefined ) {
geometry.offsets = JSON.parse( JSON.stringify( offsets ) );
}
var boundingSphere = json.boundingSphere;
if ( boundingSphere !== undefined ) {
geometry.boundingSphere = new THREE.Sphere(
......
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.GeometryLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
THREE.GeometryLoader.prototype = {
constructor: THREE.GeometryLoader,
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var loader = new THREE.XHRLoader();
loader.setCrossOrigin( this.crossOrigin );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
}, onProgress, onError );
},
setCrossOrigin: function ( value ) {
this.crossOrigin = value;
},
parse: function ( json ) {
var geometry = new THREE.Geometry();
geometry.indices = json.indices;
geometry.vertices = json.vertices;
geometry.normals = json.normals;
geometry.uvs = json.uvs;
var boundingSphere = json.boundingSphere;
if ( boundingSphere !== undefined ) {
geometry.boundingSphere = new THREE.Sphere(
new THREE.Vector3().fromArray( boundingSphere.center !== undefined ? boundingSphere.center : [ 0, 0, 0 ] ),
boundingSphere.radius
);
}
return geometry;
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册