sunag 7 роки тому
батько
коміт
d41fdb5506

+ 1 - 1
examples/js/loaders/NodeMaterialLoader.js

@@ -270,6 +270,7 @@ Object.assign( THREE.NodeMaterialLoader.prototype, {
 				case "PositionNode":
 				case "NormalNode":
 				case "ReflectNode":
+				case "LightNode":
 
 					object.scope = node.scope;
 
@@ -463,7 +464,6 @@ Object.assign( THREE.NodeMaterialLoader.prototype, {
 
 					break;
 
-				case "LightNode":
 				case "RoughnessToBlinnExponentNode":
 					break;
 

+ 21 - 1
examples/js/nodes/accessors/LightNode.js

@@ -2,12 +2,16 @@
  * @author sunag / http://www.sunag.com.br/
  */
 
-THREE.LightNode = function () {
+THREE.LightNode = function ( scope ) {
 
 	THREE.TempNode.call( this, 'v3', { shared: false } );
 
+	this.scope = scope || THREE.LightNode.TOTAL;
+
 };
 
+THREE.LightNode.TOTAL = 'total';
+
 THREE.LightNode.prototype = Object.create( THREE.TempNode.prototype );
 THREE.LightNode.prototype.constructor = THREE.LightNode;
 THREE.LightNode.prototype.nodeType = "Light";
@@ -27,3 +31,19 @@ THREE.LightNode.prototype.generate = function ( builder, output ) {
 	}
 
 };
+
+THREE.LightNode.prototype.toJSON = function ( meta ) {
+
+	var data = this.getJSONNode( meta );
+
+	if ( ! data ) {
+
+		data = this.createJSONNode( meta );
+
+		data.scope = this.scope;
+
+	}
+
+	return data;
+
+};