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

Updated builds.

上级 74f28136
......@@ -8390,8 +8390,7 @@ THREE.Object3D.prototype = {
var isRootObject = ( meta === undefined );
var data = {};
var output = { object: data };
var output = {};
// meta is a hash used to collect geometries, materials.
// not providing it implies that this is the root object
......@@ -8416,38 +8415,52 @@ THREE.Object3D.prototype = {
// standard Object3D serialization
data.uuid = this.uuid;
data.type = this.type;
var object = {};
if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
if ( this.visible !== true ) data.visible = this.visible;
object.uuid = this.uuid;
object.type = this.type;
if ( this.name !== '' ) object.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;
if ( this.visible !== true ) object.visible = this.visible;
data.matrix = this.matrix.toArray();
object.matrix = this.matrix.toArray();
//
if ( this.geometry && meta.geometries[ this.geometry.uuid ] === undefined ) {
if ( this.geometry !== undefined ) {
if ( meta.geometries[ this.geometry.uuid ] === undefined ) {
meta.geometries[ this.geometry.uuid ] = this.geometry.toJSON( meta );
}
if ( this.material && meta.materials[ this.material.uuid ] === undefined ) {
object.geometry = this.geometry.uuid;
}
if ( this.material !== undefined ) {
if ( meta.materials[ this.material.uuid ] === undefined ) {
meta.materials[ this.material.uuid ] = this.material.toJSON( meta );
}
object.material = this.material.uuid;
}
//
if ( this.children.length > 0 ) {
data.children = [];
object.children = [];
for ( var i = 0; i < this.children.length; i ++ ) {
data.children.push( this.children[ i ].toJSON( meta ).object );
object.children.push( this.children[ i ].toJSON( meta ).object );
}
......@@ -8467,6 +8480,8 @@ THREE.Object3D.prototype = {
}
output.object = object;
return output;
// extract data from the cache hash
......@@ -14113,6 +14128,24 @@ THREE.Light.prototype.copy = function ( source ) {
return this;
};
THREE.Light.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
if ( this.intensity !== undefined ) data.object.intensity = this.intensity;
if ( this.distance !== undefined ) data.object.distance = this.distance;
if ( this.angle !== undefined ) data.object.angle = this.angle;
if ( this.decay !== undefined ) data.object.decay = this.decay;
if ( this.exponent !== undefined ) data.object.exponent = this.exponent;
return data;
};
// File:src/lights/AmbientLight.js
/**
......@@ -14130,16 +14163,6 @@ THREE.AmbientLight = function ( color ) {
THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );
THREE.AmbientLight.prototype.constructor = THREE.AmbientLight;
THREE.AmbientLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
return data;
};
// File:src/lights/DirectionalLight.js
/**
......@@ -14219,17 +14242,6 @@ THREE.DirectionalLight.prototype.copy = function ( source ) {
};
THREE.DirectionalLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
return data;
};
// File:src/lights/HemisphereLight.js
/**
......@@ -14264,18 +14276,6 @@ THREE.HemisphereLight.prototype.copy = function ( source ) {
};
THREE.HemisphereLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.groundColor = this.groundColor.getHex();
data.object.intensity = this.intensity;
return data;
};
// File:src/lights/PointLight.js
/**
......@@ -14349,19 +14349,6 @@ THREE.PointLight.prototype.copy = function ( source ) {
};
THREE.PointLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
data.object.distance = this.distance;
data.object.decay = this.decay;
return data;
};
// File:src/lights/SpotLight.js
/**
......@@ -14438,20 +14425,6 @@ THREE.SpotLight.prototype.copy = function ( source ) {
this.shadowMapHeight = source.shadowMapHeight;
return this;
}
THREE.SpotLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
data.object.distance = this.distance;
data.object.angle = this.angle;
data.object.exponent = this.exponent;
data.object.decay = this.decay;
return data;
};
......@@ -18701,17 +18674,6 @@ THREE.Points.prototype.clone = function () {
};
THREE.Points.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
};
// Backwards compatibility
THREE.PointCloud = function ( geometry, material ) {
......@@ -18913,17 +18875,6 @@ THREE.Line.prototype.clone = function () {
};
THREE.Line.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
};
// DEPRECATED
THREE.LineStrip = 0;
......@@ -19305,17 +19256,6 @@ THREE.Mesh.prototype.clone = function () {
};
THREE.Mesh.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
};
// File:src/objects/Bone.js
/**
......@@ -19928,16 +19868,6 @@ THREE.Sprite.prototype.clone = function () {
};
THREE.Sprite.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.material = this.material.uuid;
return data;
};
// Backwards compatibility
THREE.Particle = THREE.Sprite;
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册