浏览代码

add import/export support to Spot/Point decayExponent.

Ben Houston 10 年之前
父节点
当前提交
612c83aeca
共有 2 个文件被更改,包括 17 次插入13 次删除
  1. 15 13
      examples/js/exporters/SceneExporter.js
  2. 2 0
      src/core/Object3D.js

+ 15 - 13
examples/js/exporters/SceneExporter.js

@@ -238,11 +238,12 @@ THREE.SceneExporter.prototype = {
 				var output = [
 				var output = [
 
 
 				'\t\t' + LabelString( getObjectName( o ) ) + ' : {',
 				'\t\t' + LabelString( getObjectName( o ) ) + ' : {',
-				'	"type"      : "PointLight",',
-				'	"color"     : ' + o.color.getHex() + ',',
-				'	"intensity" : ' + o.intensity + ',',
-				'	"position"  : ' + Vector3String( o.position ) + ',',
-				'	"distance"  : ' + o.distance + ( o.children.length ? ',' : '' )
+				'	"type"           : "PointLight",',
+				'	"color"          : ' + o.color.getHex() + ',',
+				'	"intensity"      : ' + o.intensity + ',',
+				'	"position"       : ' + Vector3String( o.position ) + ',',
+				'	"decayExponent"  : ' + o.decayExponent + ',',
+				'	"distance"       : ' + o.distance + ( o.children.length ? ',' : '' )
 
 
 				];
 				];
 
 
@@ -251,14 +252,15 @@ THREE.SceneExporter.prototype = {
 				var output = [
 				var output = [
 
 
 				'\t\t' + LabelString( getObjectName( o ) ) + ' : {',
 				'\t\t' + LabelString( getObjectName( o ) ) + ' : {',
-				'	"type"      : "SpotLight",',
-				'	"color"     : ' + o.color.getHex() + ',',
-				'	"intensity" : ' + o.intensity + ',',
-				'	"position"  : ' + Vector3String( o.position ) + ',',
-				'	"distance"  : ' + o.distance + ',',
-				'	"angle"     : ' + o.angle + ',',
-				'	"exponent"  : ' + o.exponent + ',',
-				'	"target"    : ' + LabelString( getObjectName( o.target ) ) + ( o.children.length ? ',' : '' )
+				'	"type"           : "SpotLight",',
+				'	"color"          : ' + o.color.getHex() + ',',
+				'	"intensity"      : ' + o.intensity + ',',
+				'	"position"       : ' + Vector3String( o.position ) + ',',
+				'	"distance"       : ' + o.distance + ',',
+				'	"angle"          : ' + o.angle + ',',
+				'	"exponent"       : ' + o.exponent + ',',
+				'	"decayExponent"  : ' + o.decayExponent + ',',
+				'	"target"         : ' + LabelString( getObjectName( o.target ) ) + ( o.children.length ? ',' : '' )
 
 
 				];
 				];
 
 

+ 2 - 0
src/core/Object3D.js

@@ -677,6 +677,7 @@ THREE.Object3D.prototype = {
 				data.color = object.color.getHex();
 				data.color = object.color.getHex();
 				data.intensity = object.intensity;
 				data.intensity = object.intensity;
 				data.distance = object.distance;
 				data.distance = object.distance;
+				data.decayExponent = object.decayExponent || 0;
 
 
 			} else if ( object instanceof THREE.SpotLight ) {
 			} else if ( object instanceof THREE.SpotLight ) {
 
 
@@ -685,6 +686,7 @@ THREE.Object3D.prototype = {
 				data.distance = object.distance;
 				data.distance = object.distance;
 				data.angle = object.angle;
 				data.angle = object.angle;
 				data.exponent = object.exponent;
 				data.exponent = object.exponent;
+				data.decayExponent = object.decayExponent || 0;
 
 
 			} else if ( object instanceof THREE.HemisphereLight ) {
 			} else if ( object instanceof THREE.HemisphereLight ) {