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

Converted space indents to tabs. See #6252.

上级 645c8f37
......@@ -70,4 +70,4 @@ THREE.OrthographicCamera.prototype.toJSON = function ( meta ) {
return data;
};
\ No newline at end of file
};
......@@ -152,4 +152,4 @@ THREE.PerspectiveCamera.prototype.toJSON = function ( meta ) {
return data;
};
\ No newline at end of file
};
......@@ -876,25 +876,25 @@ THREE.BufferGeometry.prototype = {
toJSON: function() {
// we will store all serialization data on 'data'
var data = {};
// we will store all serialization data on 'data'
var data = {};
// add metadata
data.metadata = {
// add metadata
data.metadata = {
version: 4.4,
type: 'BufferGeometry',
generator: 'BufferGeometry.toJSON'
}
// standard BufferGeometry serialization
// standard BufferGeometry serialization
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
data.data = {};
data.data.attributes = {};
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
data.data = {};
data.data.attributes = {};
var attributes = this.attributes;
var attributes = this.attributes;
var offsets = this.offsets;
var boundingSphere = this.boundingSphere;
......@@ -927,7 +927,7 @@ THREE.BufferGeometry.prototype = {
}
return data;
return data;
},
......
......@@ -799,23 +799,23 @@ THREE.Geometry.prototype = {
toJSON: function() {
// we will store all serialization data on 'data'
var data = {};
// we will store all serialization data on 'data'
var data = {};
// add metadata
data.metadata = {
// add metadata
data.metadata = {
version: 4.4,
type: 'Geometry',
generator: 'Geometry.toJSON'
};
// standard Geometry serialization
// standard Geometry serialization
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
if ( this.parameters !== undefined ) {
if ( this.parameters !== undefined ) {
var parameters = this.parameters;
......@@ -996,7 +996,7 @@ THREE.Geometry.prototype = {
if ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility
data.data.faces = faces;
return data;
return data;
},
......
......@@ -571,85 +571,85 @@ THREE.Object3D.prototype = {
var isRootObject = ( meta === undefined );
// we will store all serialization data on 'data'
var data = {};
var metadata;
// meta is a hash used to collect geometries, materials.
// not providing it implies that this is the root object
// being serialized.
if ( isRootObject ) {
// initialize meta obj
meta = {
geometries: {},
materials: {}
}
// add metadata
metadata = {
// we will store all serialization data on 'data'
var data = {};
var metadata;
// meta is a hash used to collect geometries, materials.
// not providing it implies that this is the root object
// being serialized.
if ( isRootObject ) {
// initialize meta obj
meta = {
geometries: {},
materials: {}
}
// add metadata
metadata = {
version: 4.4,
type: 'Object',
generator: 'Object3D.toJSON'
}
}
// standard Object3D serialization
}
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
if ( this.visible !== true ) data.visible = this.visible;
// standard Object3D serialization
data.matrix = this.matrix.toArray();
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
if ( this.visible !== true ) data.visible = this.visible;
if ( this.children.length > 0 ) {
data.matrix = this.matrix.toArray();
data.children = [];
if ( this.children.length > 0 ) {
for ( var i = 0; i < this.children.length; i ++ ) {
data.children = [];
data.children.push( this.children[ i ].toJSON( meta ).object );
for ( var i = 0; i < this.children.length; i ++ ) {
}
data.children.push( this.children[ i ].toJSON( meta ).object );
}
}
// wrap serialized object with additional data
}
var output;
// wrap serialized object with additional data
if ( isRootObject ) {
var output;
output = {
metadata: metadata,
geometries: extractFromCache(meta.geometries),
materials: extractFromCache(meta.materials),
object: data
};
if ( isRootObject ) {
} else {
output = {
metadata: metadata,
geometries: extractFromCache(meta.geometries),
materials: extractFromCache(meta.materials),
object: data
};
output = { object: data };
} else {
}
output = { object: data };
return output;
}
// extract data from the cache hash
// remove metadata on each item
// and return as array
function extractFromCache ( cache ) {
var values = [];
for ( var key in cache ) {
var data = cache[ key ];
delete data.metadata;
values.push( data );
}
return values;
}
return output;
// extract data from the cache hash
// remove metadata on each item
// and return as array
function extractFromCache ( cache ) {
var values = [];
for ( var key in cache ) {
var data = cache[ key ];
delete data.metadata;
values.push( data );
}
return values;
}
},
......
......@@ -25,10 +25,10 @@ THREE.AmbientLight.prototype.clone = function () {
THREE.AmbientLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.color = this.color.getHex();
return data;
return data;
};
\ No newline at end of file
};
......@@ -47,7 +47,7 @@ THREE.DirectionalLight = function ( color, intensity ) {
this.shadowCascadeHeight = [ 512, 512, 512 ];
this.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];
this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
this.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];
this.shadowCascadeArray = [];
......@@ -106,7 +106,7 @@ THREE.DirectionalLight.prototype.clone = function () {
light.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 );
light.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 );
light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );
light.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );
return light;
......@@ -114,11 +114,11 @@ THREE.DirectionalLight.prototype.clone = function () {
THREE.DirectionalLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
return data;
return data;
};
\ No newline at end of file
};
......@@ -33,11 +33,11 @@ THREE.HemisphereLight.prototype.clone = function () {
THREE.HemisphereLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.groundColor = this.groundColor.getHex();
return data;
return data;
};
\ No newline at end of file
};
......@@ -33,13 +33,13 @@ THREE.PointLight.prototype.clone = function () {
THREE.PointLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, 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;
return data;
};
\ No newline at end of file
};
......@@ -83,7 +83,7 @@ THREE.SpotLight.prototype.clone = function () {
THREE.SpotLight.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.color = this.color.getHex();
data.object.intensity = this.intensity;
......@@ -92,6 +92,6 @@ THREE.SpotLight.prototype.toJSON = function ( meta ) {
data.object.exponent = this.exponent;
data.object.decay = this.decay;
return data;
return data;
};
\ No newline at end of file
};
......@@ -109,26 +109,26 @@ THREE.Material.prototype = {
toJSON: function() {
// we will store all serialization data on 'data'
var data = {};
// we will store all serialization data on 'data'
var data = {};
// add metadata
data.metadata = {
// add metadata
data.metadata = {
version: 4.4,
type: 'Material',
generator: 'Material.toJSON'
}
// standard Material serialization
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
// standard Material serialization
data.type = this.type;
data.uuid = this.uuid;
if ( this.name !== '' ) data.name = this.name;
if ( this.opacity < 1 ) data.opacity = this.opacity;
if ( this.opacity < 1 ) data.opacity = this.opacity;
if ( this.transparent !== false ) data.transparent = this.transparent;
if ( this.wireframe !== false ) data.wireframe = this.wireframe;
return data;
return data;
},
......
......@@ -121,10 +121,10 @@ THREE.MeshBasicMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.color = this.color.getHex();
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
return data;
};
\ No newline at end of file
};
......@@ -48,9 +48,9 @@ THREE.MeshDepthMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
return data;
};
\ No newline at end of file
};
......@@ -134,12 +134,12 @@ THREE.MeshLambertMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.color = this.color.getHex();
data.emissive = this.emissive.getHex();
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.shading !== THREE.SmoothShading ) data.shading = this.shading;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
data.emissive = this.emissive.getHex();
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.shading !== THREE.SmoothShading ) data.shading = this.shading;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
return data;
};
\ No newline at end of file
};
......@@ -49,9 +49,9 @@ THREE.MeshPhongMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
return data;
};
\ No newline at end of file
};
......@@ -174,15 +174,15 @@ THREE.MeshPhongMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.color = this.color.getHex();
data.emissive = this.emissive.getHex();
data.specular = this.specular.getHex();
data.shininess = this.shininess;
data.emissive = this.emissive.getHex();
data.specular = this.specular.getHex();
data.shininess = this.shininess;
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.shading !== THREE.SmoothShading ) data.shading = this.shading;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.shading !== THREE.SmoothShading ) data.shading = this.shading;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.side !== THREE.FrontSide ) data.side = this.side;
return data;
};
\ No newline at end of file
};
......@@ -69,12 +69,12 @@ THREE.MeshDepthMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.size = this.size;
data.sizeAttenuation = this.sizeAttenuation;
data.color = this.color.getHex();
data.size = this.size;
data.sizeAttenuation = this.sizeAttenuation;
data.color = this.color.getHex();
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
if ( this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
if ( this.blending !== THREE.NormalBlending ) data.blending = this.blending;
return data;
......
......@@ -114,9 +114,9 @@ THREE.ShaderMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.uniforms = this.uniforms;
data.vertexShader = this.vertexShader;
data.fragmentShader = this.fragmentShader;
data.uniforms = this.uniforms;
data.vertexShader = this.vertexShader;
data.fragmentShader = this.fragmentShader;
return data;
......
......@@ -60,7 +60,7 @@ THREE.SpriteMaterial.prototype.toJSON = function () {
var data = THREE.Material.prototype.toJSON.call( this );
data.color = this.color.getHex();
data.color = this.color.getHex();
return data;
......
......@@ -194,7 +194,7 @@ THREE.Line.prototype.clone = function ( object ) {
THREE.Line.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
data.object.mode = this.mode;
......@@ -211,6 +211,6 @@ THREE.Line.prototype.toJSON = function ( meta ) {
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
return data;
};
\ No newline at end of file
};
......@@ -326,7 +326,7 @@ THREE.Mesh.prototype.clone = function ( object, recursive ) {
THREE.Mesh.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
// only serialize if not in meta geometries cache
if ( meta.geometries[ this.geometry.uuid ] === undefined ) {
......@@ -341,6 +341,6 @@ THREE.Mesh.prototype.toJSON = function ( meta ) {
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
return data;
};
\ No newline at end of file
};
......@@ -155,7 +155,7 @@ THREE.PointCloud.prototype.clone = function ( object ) {
THREE.PointCloud.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
// only serialize if not in meta geometries cache
if ( meta.geometries[ this.geometry.uuid ] === undefined ) {
......@@ -170,7 +170,7 @@ THREE.PointCloud.prototype.toJSON = function ( meta ) {
data.object.geometry = this.geometry.uuid;
data.object.material = this.material.uuid;
return data;
return data;
};
......
......@@ -71,7 +71,7 @@ THREE.Sprite.prototype.clone = function ( object ) {
THREE.Sprite.prototype.toJSON = function ( meta ) {
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
var data = THREE.Object3D.prototype.toJSON.call( this, meta );
// only serialize if not in meta materials cache
if ( meta.materials[ this.material.uuid ] === undefined ) {
......@@ -80,7 +80,7 @@ THREE.Sprite.prototype.toJSON = function ( meta ) {
data.object.material = this.material.uuid;
return data;
return data;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册