Explorar o código

Clean up of SceneLoader+properties.

Mr.doob %!s(int64=13) %!d(string=hai) anos
pai
achega
6c2bdaf522

+ 468 - 472
examples/scenes/test_scene.js

@@ -1,524 +1,520 @@
 {
 
-"metadata":
-{
-	"formatVersion": 3,
-	"type"		   : "scene"
-},
-
-"urlBaseType" : "relativeToHTML",
-
-"objects":
-{
-	"cube1" : {
-		"geometry" : "cubeNormals",
-		"materials": [ "lambert_red" ],
-		"position" : [ 0, 0, 0 ],
-		"rotation" : [ 0, -0.3, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
+	"metadata": {
+		"formatVersion": 3,
+		"type" : "scene"
 	},
 
-	"cube2" : {
-		"geometry" : "cubeWire",
-		"materials": [ "basic_white" ],
-		"position" : [ 0, 0, 0 ],
-		"rotation" : [ 0, -0.3, 0 ],
-		"scale"	   : [ 2, 2, 2 ],
-		"visible"  : true
-	},
-
-	"cube3" : {
-		"geometry" : "cube",
-		"materials": [ "minecraft" ],
-		"position" : [ -30, -5, 25 ],
-		"rotation" : [ 0, 0.8, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
+	"urlBaseType" : "relativeToHTML",
 
-	"sphere_lambert" : {
-		"geometry" : "sphere",
-		"materials": [ "lambert_green" ],
-		"position" : [ -20, -5, 15 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
-
-	"sphere_refraction" : {
-		"geometry" : "sphere",
-		"materials": [ "basic_refraction" ],
-		"position" : [ 50, 45, -50 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
-
-	"icosahedron" : {
-		"geometry" : "icosahedron",
-		"materials": [ "faceted_white" ],
-		"position" : [ 20, 10, -60 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
-
-
-	"torus" : {
-		"geometry" : "torus",
-		"materials": [ "phong_orange" ],
-		"position" : [ -20, 5, -50 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 2, 2, 2 ],
-		"visible"  : true
-	},
+	"objects": {
 
-	"cone" : {
-		"geometry" : "cone",
-		"materials": [ "lambert_blue" ],
-		"position" : [ -50, 15, -50 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
-
-	"cylinder" : {
-		"geometry" : "cylinder",
-		"materials": [ "lambert_blue" ],
-		"position" : [ 50, 15, -50 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 1, 1, 1 ],
-		"visible"  : true
-	},
-
-	"colorcube1" : {
-		"geometry" : "colorcube",
-		"materials": [],
-		"position" : [ -10, -5, 30 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 5, 5, 5 ],
-		"visible"  : true,
-		"children" : {
-			"colorcube2" : {
-				"geometry" : "colorcube",
-				"materials": [],
-				"position" : [ 0, 2, 0 ],
-				"rotation" : [ 0.1, 0.1, 0.1 ],
-				"scale"    : [ 0.5, 0.5, 0.5 ],
-				"visible"  : true,
-				"children" : {
-					"colorcube3" : {
-						"geometry" : "colorcube",
-						"materials": [],
-						"position" : [ 0, 2, 0 ],
-						"rotation" : [ 0.1, 0.1, 0.1 ],
-						"scale"    : [ 0.5, 0.5, 0.5 ],
-						"visible"  : true,
-						"children" : {
-							"colorcube4" : {
-								"geometry" : "colorcube",
-								"materials": [],
-								"position" : [ 0, 2, 0 ],
-								"rotation" : [ 0.1, 0.1, 0.1 ],
-								"scale"    : [ 0.5, 0.5, 0.5 ],
-								"visible"  : true
+		"cube1" : {
+			"geometry" : "cubeNormals",
+			"materials": [ "lambert_red" ],
+			"position" : [ 0, 0, 0 ],
+			"rotation" : [ 0, -0.3, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true,
+			"properties" : {
+				"rotating" : true
+			}
+		},
+
+		"cube2" : {
+			"geometry" : "cubeWire",
+			"materials": [ "basic_white" ],
+			"position" : [ 0, 0, 0 ],
+			"rotation" : [ 0, -0.3, 0 ],
+			"scale"	   : [ 2, 2, 2 ],
+			"visible"  : true
+		},
+
+		"cube3" : {
+			"geometry" : "cube",
+			"materials": [ "minecraft" ],
+			"position" : [ -30, -5, 25 ],
+			"rotation" : [ 0, 0.8, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+		"sphere_lambert" : {
+			"geometry" : "sphere",
+			"materials": [ "lambert_green" ],
+			"position" : [ -20, -5, 15 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+		"sphere_refraction" : {
+			"geometry" : "sphere",
+			"materials": [ "basic_refraction" ],
+			"position" : [ 50, 45, -50 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+		"icosahedron" : {
+			"geometry" : "icosahedron",
+			"materials": [ "faceted_white" ],
+			"position" : [ 20, 10, -60 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+
+		"torus" : {
+			"geometry" : "torus",
+			"materials": [ "phong_orange" ],
+			"position" : [ -20, 5, -50 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 2, 2, 2 ],
+			"visible"  : true
+		},
+
+		"cone" : {
+			"geometry" : "cone",
+			"materials": [ "lambert_blue" ],
+			"position" : [ -50, 15, -50 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+		"cylinder" : {
+			"geometry" : "cylinder",
+			"materials": [ "lambert_blue" ],
+			"position" : [ 50, 15, -50 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 1, 1, 1 ],
+			"visible"  : true
+		},
+
+		"colorcube1" : {
+			"geometry" : "colorcube",
+			"materials": [],
+			"position" : [ -10, -5, 30 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 5, 5, 5 ],
+			"visible"  : true,
+			"children" : {
+				"colorcube2" : {
+					"geometry" : "colorcube",
+					"materials": [],
+					"position" : [ 0, 2, 0 ],
+					"rotation" : [ 0.1, 0.1, 0.1 ],
+					"scale"    : [ 0.5, 0.5, 0.5 ],
+					"visible"  : true,
+					"children" : {
+						"colorcube3" : {
+							"geometry" : "colorcube",
+							"materials": [],
+							"position" : [ 0, 2, 0 ],
+							"rotation" : [ 0.1, 0.1, 0.1 ],
+							"scale"    : [ 0.5, 0.5, 0.5 ],
+							"visible"  : true,
+							"children" : {
+								"colorcube4" : {
+									"geometry" : "colorcube",
+									"materials": [],
+									"position" : [ 0, 2, 0 ],
+									"rotation" : [ 0.1, 0.1, 0.1 ],
+									"scale"    : [ 0.5, 0.5, 0.5 ],
+									"visible"  : true
+								}
 							}
 						}
 					}
 				}
 			}
+		},
+
+		"veyron" : {
+			"geometry" : "veyron",
+			"materials": [ "face" ],
+			"position" : [ 40, -1, 0 ],
+			"rotation" : [ 0, 0.3, 0 ],
+			"scale"	   : [ 0.25, 0.25, 0.25 ],
+			"visible"  : true
+		},
+
+		"walt" : {
+			"geometry" : "WaltHead",
+			"materials": [ "lambert_cube" ],
+			"position" : [ -45, 10, 0 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 0.5, 0.5, 0.5 ],
+			"visible"  : true
+		},
+
+		"quad_bg" : {
+			"geometry" : "quad",
+			"materials": [ "textured_bg" ],
+			"position" : [ 0, 15, -90 ],
+			"rotation" : [ 0, 0, 0 ],
+			"scale"	   : [ 20, 20, 20 ],
+			"visible"  : true
+		},
+
+		"ground" : {
+			"geometry" : "plane",
+			"materials": [ "basic_gray" ],
+			"position" : [ 0, -10, 0 ],
+			"rotation" : [ -1.57, 0, 0 ],
+			"scale"	   : [ 100, 100, 100 ],
+			"visible"  : true
 		}
-	},
-
-	"veyron" : {
-		"geometry" : "veyron",
-		"materials": [ "face" ],
-		"position" : [ 40, -1, 0 ],
-		"rotation" : [ 0, 0.3, 0 ],
-		"scale"	   : [ 0.25, 0.25, 0.25 ],
-		"visible"  : true
-	},
-
-	"walt" : {
-		"geometry" : "WaltHead",
-		"materials": [ "lambert_cube" ],
-		"position" : [ -45, 10, 0 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 0.5, 0.5, 0.5 ],
-		"visible"  : true
-	},
-
-	"quad_bg" : {
-		"geometry" : "quad",
-		"materials": [ "textured_bg" ],
-		"position" : [ 0, 15, -90 ],
-		"rotation" : [ 0, 0, 0 ],
-		"scale"	   : [ 20, 20, 20 ],
-		"visible"  : true
-	},
-
-	"ground" : {
-		"geometry" : "plane",
-		"materials": [ "basic_gray" ],
-		"position" : [ 0, -10, 0 ],
-		"rotation" : [ -1.57, 0, 0 ],
-		"scale"	   : [ 100, 100, 100 ],
-		"visible"  : true
-	}
-
-},
-
-"geometries":
-{
-	"cube": {
-		"type"  : "cube",
-		"width" : 10,
-		"height": 10,
-		"depth" : 10,
-		"segmentsWidth"  : 1,
-		"segmentsHeight" : 1,
-		"segmentsDepth"  : 1,
-		"flipped" : false,
-		"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
-	},
-
-	"cubeNormals": {
-		"type"  : "cube",
-		"width" : 10,
-		"height": 10,
-		"depth" : 10,
-		"segmentsWidth"  : 1,
-		"segmentsHeight" : 1,
-		"segmentsDepth"  : 1,
-		"flipped" : false,
-		"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
-	},
-
-	"cubeWire": {
-		"type"  : "cube",
-		"width" : 10,
-		"height": 10,
-		"depth" : 10,
-		"segmentsWidth"  : 1,
-		"segmentsHeight" : 1,
-		"segmentsDepth"  : 1,
-		"flipped" : false,
-		"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
-	},
-
-	"plane": {
-		"type"   : "plane",
-		"width"  : 10,
-		"height" : 10,
-		"segmentsWidth"  : 50,
-		"segmentsHeight" : 50
-	},
-
-	"quad": {
-		"type"   : "plane",
-		"width"  : 10,
-		"height" : 10,
-		"segmentsWidth"  : 1,
-		"segmentsHeight" : 1
-	},
-
-	"sphere": {
-		"type"    : "sphere",
-		"radius"  : 5,
-		"segmentsWidth"  : 32,
-		"segmentsHeight" : 16
-	},
-
-	"icosahedron": {
-		"type"    : "icosahedron",
-		"radius"  : 20,
-		"subdivisions"  : 2
-	},
-
-	"torus": {
-		"type"    : "torus",
-		"radius"  : 5,
-		"tube"	  : 2,
-		"segmentsR" : 16,
-		"segmentsT" : 32
-	},
-
-	"cylinder": {
-		"type"    : "cylinder",
-		"topRad"   : 5,
-		"botRad"   : 5,
-		"height"   : 50,
-		"radSegs"  : 32,
-		"heightSegs": 1
-	},
-
-	"cone": {
-		"type"    : "cylinder",
-		"topRad"   : 0,
-		"botRad"   : 5,
-		"height"   : 50,
-		"radSegs"  : 32,
-		"heightSegs" : 1
-	},
-
-	"WaltHead": {
-		"type": "bin_mesh",
-		"url" : "obj/walt/WaltHead_bin.js"
-	},
-
-	"veyron": {
-		"type": "bin_mesh",
-		"url" : "obj/veyron/VeyronNoUv_bin.js"
-	},
-
-	"colorcube": {
-		"type": "embedded_mesh",
-		"id"  : "cube_fvc"
-	}
 
-},
-
-"embeds": {
-
-	"cube_fvc": {
-
-    "metadata" : { "formatVersion" : 3 },
-
-    "scale" : 1.0,
-
-    "materials": [	{
-	"DbgColor" : 15658734,
-	"DbgIndex" : 0,
-	"DbgName" : "Material",
-	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.8, 0.8, 0.8],
-	"colorSpecular" : [0.5, 0.5, 0.5],
-	"specularCoef" : 50,
-	"transparency" : 1.0,
-	"vertexColors" : true
-	}],
-
-    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
-
-    "morphTargets": [],
-
-    "normals": [],
-
-    "colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
-
-    "uvs": [[]],
-
-    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21],
-
-    "edges" : []
-
-	}
-
-},
-
-"materials":
-{
-
-	"basic_gray": {
-		"type": "MeshBasicMaterial",
-		"parameters": { "color": 6710886, "wireframe": true }
 	},
 
-	"basic_white": {
-		"type": "MeshBasicMaterial",
-		"parameters": { "color": 16777215, "wireframe": true }
-	},
+	"geometries": {
+
+		"cube": {
+			"type"  : "cube",
+			"width" : 10,
+			"height": 10,
+			"depth" : 10,
+			"segmentsWidth"  : 1,
+			"segmentsHeight" : 1,
+			"segmentsDepth"  : 1,
+			"flipped" : false,
+			"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
+		},
+
+		"cubeNormals": {
+			"type"  : "cube",
+			"width" : 10,
+			"height": 10,
+			"depth" : 10,
+			"segmentsWidth"  : 1,
+			"segmentsHeight" : 1,
+			"segmentsDepth"  : 1,
+			"flipped" : false,
+			"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
+		},
+
+		"cubeWire": {
+			"type"  : "cube",
+			"width" : 10,
+			"height": 10,
+			"depth" : 10,
+			"segmentsWidth"  : 1,
+			"segmentsHeight" : 1,
+			"segmentsDepth"  : 1,
+			"flipped" : false,
+			"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
+		},
+
+		"plane": {
+			"type"   : "plane",
+			"width"  : 10,
+			"height" : 10,
+			"segmentsWidth"  : 50,
+			"segmentsHeight" : 50
+		},
+
+		"quad": {
+			"type"   : "plane",
+			"width"  : 10,
+			"height" : 10,
+			"segmentsWidth"  : 1,
+			"segmentsHeight" : 1
+		},
+
+		"sphere": {
+			"type"    : "sphere",
+			"radius"  : 5,
+			"segmentsWidth"  : 32,
+			"segmentsHeight" : 16
+		},
+
+		"icosahedron": {
+			"type"    : "icosahedron",
+			"radius"  : 20,
+			"subdivisions"  : 2
+		},
+
+		"torus": {
+			"type"    : "torus",
+			"radius"  : 5,
+			"tube"	  : 2,
+			"segmentsR" : 16,
+			"segmentsT" : 32
+		},
+
+		"cylinder": {
+			"type"    : "cylinder",
+			"topRad"   : 5,
+			"botRad"   : 5,
+			"height"   : 50,
+			"radSegs"  : 32,
+			"heightSegs": 1
+		},
+
+		"cone": {
+			"type"    : "cylinder",
+			"topRad"   : 0,
+			"botRad"   : 5,
+			"height"   : 50,
+			"radSegs"  : 32,
+			"heightSegs" : 1
+		},
+
+		"WaltHead": {
+			"type": "bin_mesh",
+			"url" : "obj/walt/WaltHead_bin.js"
+		},
+
+		"veyron": {
+			"type": "bin_mesh",
+			"url" : "obj/veyron/VeyronNoUv_bin.js"
+		},
+
+		"colorcube": {
+			"type": "embedded_mesh",
+			"id"  : "cube_fvc"
+		}
 
-	"faceted_white": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16777215, "shading": "flat" }
 	},
 
-	"lambert_red": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16711680 }
-	},
+	"embeds": {
 
-	"lambert_green": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 30481, "blending": "AdditiveBlending", "transparent": true }
-	},
+		"cube_fvc": {
 
-	"lambert_blue": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 21930 }
-	},
+			"metadata" : {
+				"formatVersion" : 3
+			},
 
-	"phong_orange": {
-		"type": "MeshPhongMaterial",
-		"parameters": { "color": 0, "specular": 11162880 }
-	},
+			"scale" : 1.0,
 
-	"basic_refraction": {
-		"type": "MeshBasicMaterial",
-		"parameters": { "color": 16777215, "envMap": "cube_refraction", "refractionRatio": 0.95 }
-	},
+			"materials": [{
+				"DbgColor" : 15658734,
+				"DbgIndex" : 0,
+				"DbgName" : "Material",
+				"colorAmbient" : [0.0, 0.0, 0.0],
+				"colorDiffuse" : [0.8, 0.8, 0.8],
+				"colorSpecular" : [0.5, 0.5, 0.5],
+				"specularCoef" : 50,
+				"transparency" : 1.0,
+				"vertexColors" : true
+			}],
 
-	"lambert_cube": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16737792, "envMap": "cube_reflection", "combine": "MixOperation", "reflectivity": 0.3 }
-	},
+			"vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
 
-	"chrome": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16777215, "envMap": "cube_reflection" }
-	},
+			"morphTargets": [],
 
-	"darkerchrome": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 2236962, "envMap": "cube_reflection" }
-	},
+			"normals": [],
 
-	"glass": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 1052742, "envMap": "cube_reflection", "opacity": 0.25, "transparent": true }
-	},
+			"colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
 
-	"interior": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 328965 }
-	},
-
-	"backlights": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16711680, "opacity": 0.5 }
-	},
+			"uvs": [[]],
 
-	"backsignals": {
-		"type": "MeshLambertMaterial",
-		"parameters": { "color": 16759552, "opacity": 0.5 }
-	},
+			"faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
 
-	"textured_bg": {
-		"type": "MeshBasicMaterial",
-		"parameters": { "color": 16777215, "map": "texture_bg" }
-	},
+		}
 
-	"minecraft": {
-		"type": "MeshBasicMaterial",
-		"parameters": { "color": 16777215, "map": "texture_minecraft" }
 	},
 
-	"face": {
-		"type": "MeshFaceMaterial",
-		"parameters": {}
-	}
-
-},
-
-"textures":
-{
+	"materials": {
+
+		"basic_gray": {
+			"type": "MeshBasicMaterial",
+			"parameters": { "color": 6710886, "wireframe": true }
+		},
+
+		"basic_white": {
+			"type": "MeshBasicMaterial",
+			"parameters": { "color": 16777215, "wireframe": true }
+		},
+
+		"faceted_white": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16777215, "shading": "flat" }
+		},
+
+		"lambert_red": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16711680 }
+		},
+
+		"lambert_green": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 30481, "blending": "AdditiveBlending", "transparent": true }
+		},
+
+		"lambert_blue": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 21930 }
+		},
+
+		"phong_orange": {
+			"type": "MeshPhongMaterial",
+			"parameters": { "color": 0, "specular": 11162880 }
+		},
+
+		"basic_refraction": {
+			"type": "MeshBasicMaterial",
+			"parameters": { "color": 16777215, "envMap": "cube_refraction", "refractionRatio": 0.95 }
+		},
+
+		"lambert_cube": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16737792, "envMap": "cube_reflection", "combine": "MixOperation", "reflectivity": 0.3 }
+		},
+
+		"chrome": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16777215, "envMap": "cube_reflection" }
+		},
+
+		"darkerchrome": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 2236962, "envMap": "cube_reflection" }
+		},
+
+		"glass": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 1052742, "envMap": "cube_reflection", "opacity": 0.25, "transparent": true }
+		},
+
+		"interior": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 328965 }
+		},
+
+		"backlights": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16711680, "opacity": 0.5 }
+		},
+
+		"backsignals": {
+			"type": "MeshLambertMaterial",
+			"parameters": { "color": 16759552, "opacity": 0.5 }
+		},
+
+		"textured_bg": {
+			"type": "MeshBasicMaterial",
+			"parameters": { "color": 16777215, "map": "texture_bg" }
+		},
+
+		"minecraft": {
+			"type": "MeshBasicMaterial",
+			"parameters": { "color": 16777215, "map": "texture_minecraft" }
+		},
+
+		"face": {
+			"type": "MeshFaceMaterial",
+			"parameters": {}
+		}
 
-	"cube_reflection": {
-		"url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
-				 "textures/cube/SwedishRoyalCastle/nx.jpg",
-				 "textures/cube/SwedishRoyalCastle/py.jpg",
-				 "textures/cube/SwedishRoyalCastle/ny.jpg",
-				 "textures/cube/SwedishRoyalCastle/pz.jpg",
-				 "textures/cube/SwedishRoyalCastle/nz.jpg"
-				]
 	},
 
-	"cube_refraction": {
-		"url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
-				 "textures/cube/SwedishRoyalCastle/nx.jpg",
-				 "textures/cube/SwedishRoyalCastle/py.jpg",
-				 "textures/cube/SwedishRoyalCastle/ny.jpg",
-				 "textures/cube/SwedishRoyalCastle/nz.jpg",
-				 "textures/cube/SwedishRoyalCastle/pz.jpg"
-				],
-		"mapping": "CubeRefractionMapping"
-	},
+	"textures": {
+
+		"cube_reflection": {
+			"url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
+					 "textures/cube/SwedishRoyalCastle/nx.jpg",
+					 "textures/cube/SwedishRoyalCastle/py.jpg",
+					 "textures/cube/SwedishRoyalCastle/ny.jpg",
+					 "textures/cube/SwedishRoyalCastle/pz.jpg",
+					 "textures/cube/SwedishRoyalCastle/nz.jpg"
+					]
+		},
+
+		"cube_refraction": {
+			"url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
+					 "textures/cube/SwedishRoyalCastle/nx.jpg",
+					 "textures/cube/SwedishRoyalCastle/py.jpg",
+					 "textures/cube/SwedishRoyalCastle/ny.jpg",
+					 "textures/cube/SwedishRoyalCastle/nz.jpg",
+					 "textures/cube/SwedishRoyalCastle/pz.jpg"
+					],
+			"mapping": "CubeRefractionMapping"
+		},
+
+		"texture_bg": {
+			"url": "textures/cube/SwedishRoyalCastle/pz.jpg"
+		},
+
+		"texture_minecraft": {
+			"url": "textures/minecraft/grass.png",
+			"magFilter": "NearestFilter",
+			"minFilter": "LinearMipMapLinearFilter"
+		}
 
-	"texture_bg": {
-		"url": "textures/cube/SwedishRoyalCastle/pz.jpg"
 	},
 
-	"texture_minecraft": {
-		"url": "textures/minecraft/grass.png",
-		"magFilter": "NearestFilter",
-		"minFilter": "LinearMipMapLinearFilter"
-	}
-
-},
+	"cameras": {
+		"cam1": {
+			"type"  : "perspective",
+			"fov"   : 50,
+			"aspect": 1.33333,
+			"near"  : 1,
+			"far"   : 1000,
+			"position": [0,0,100],
+			"target"  : [0,0,0]
+		},
+
+		"cam2": {
+			"type"  : "ortho",
+			"left"  : 0,
+			"right" : 1024,
+			"top"   : 0,
+			"bottom": 1024,
+			"near"  : 1,
+			"far"   : 1000,
+			"position": [0,0,0],
+			"target"  : [0,0,0]
+		}
 
-"cameras":
-{
-	"cam1": {
-		"type"  : "perspective",
-		"fov"   : 50,
-		"aspect": 1.33333,
-		"near"  : 1,
-		"far"   : 1000,
-		"position": [0,0,100],
-		"target"  : [0,0,0]
 	},
 
-	"cam2": {
-		"type"  : "ortho",
-		"left"  : 0,
-		"right" : 1024,
-		"top"   : 0,
-		"bottom": 1024,
-		"near"  : 1,
-		"far"   : 1000,
-		"position": [0,0,0],
-		"target"  : [0,0,0]
-	}
+	"lights": {
+		"light1": {
+			"type"		 : "directional",
+			"direction"	 : [0,1,1],
+			"color" 	 : 16777215,
+			"intensity"	 : 0.8
+		},
 
-},
+		"light2": {
+			"type"	  : "point",
+			"position": [0,0,0],
+			"color"   : 16777215
+		}
 
-"lights":
-{
-	"light1": {
-		"type"		 : "directional",
-		"direction"	 : [0,1,1],
-		"color" 	 : 16777215,
-		"intensity"	 : 0.8
 	},
 
-	"light2": {
-		"type"	  : "point",
-		"position": [0,0,0],
-		"color"   : 16777215
-	}
-
-},
+	"fogs":	{
+		"basic": {
+			"type": "linear",
+			"color": [1,0,0],
+			"near": 1,
+			"far": 1000
+		},
 
-"fogs":
-{
-	"basic": {
-		"type" : "linear",
-		"color": [1,0,0],
-		"near" : 1,
-		"far"  : 1000
-	},
+		"exponential": {
+			"type": "exp2",
+			"color": [1,1,1],
+			"density": 0.005
+		},
 
-	"exponential": {
-		"type"    : "exp2",
-		"color"   : [1,1,1],
-		"density" : 0.005
+		"black": {
+			"type": "exp2",
+			"color": [0,0,0],
+			"density": 0.005
+		}
 	},
 
-	"black": {
-		"type"    : "exp2",
-		"color"   : [0,0,0],
-		"density" : 0.005
+	"defaults": {
+		"bgcolor": [0,0,0],
+		"bgalpha": 1,
+		"camera": "cam1",
+		"fog": "black"
 	}
-},
-
-"defaults" :
-{
-	"bgcolor" : [0,0,0],
-	"bgalpha" : 1,
-	"camera"  : "cam1",
-	"fog"	  : "black"
-}
 
 }

+ 0 - 357
examples/scenes/test_scene_nested.js

@@ -1,357 +0,0 @@
-{
-
-    "metadata":
-        {
-	"formatVersion": 3,
-	"type"		   : "scene"
-    },
-
-    "urlBaseType" : "relativeToHTML",
-
-    "objects":
-        {
-	"rootNode" : {
-            "position" : [ 0, 0, 0 ],
-            "rotation" : [ 0, 0, 0 ],
-            "scale"	: [ 1, 1, 1 ],
-            "visible"  : true,
-            "properties" : {
-               "displayName" : "root"
-            },
-            "children" : {
-
-                "row1" : {
-                    "position" : [ 0, 0, 0 ],
-                    "rotation" : [ 0, 0, 0 ],
-                    "scale"    : [ 1, 1, 1 ],
-                    "visible"  : true,
-                    "properties" : {
-                        "displayName" : "row"
-                    },
-                    "children" : {
-
-                        "cube11" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_green" ],
-                            "position" : [ 0, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-                        
-                        "cube12" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_green" ],
-                            "position" : [ 10, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-                        
-                        "cube13" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_green" ],
-                            "position" : [ 10, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-                        
-                        "cube14" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_green" ],
-                            "position" : [ 0, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        }
-                    }
-                },
-            
-            
-                "row2" : {
-                    "position" : [ 0, 0, 10 ],
-                    "rotation" : [ 0, 0, 0 ],
-                    "scale"    : [ 1, 1, 1 ],
-                    "visible"  : true,
-                    "properties" : {
-                        "displayName" : "row"
-                    },
-                    "children" : {
-
-                        "cube21" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_red" ],
-                            "position" : [ 0, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true, 
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube22" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_red" ],
-                            "position" : [ 10, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube23" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_red" ],
-                            "position" : [ 10, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube24" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_red" ],
-                            "position" : [ 0, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        }
-                    }
-                },
-                
-                
-                "row3" : {
-                    "position" : [ 0, 0, 20 ],
-                    "rotation" : [ 0, 0, 0.4 ],
-                    "scale"    : [ 1, 1, 1 ],
-                    "visible"  : true,
-                    "properties" : {
-                        "displayName" : "row"
-                    },
-                    "children" : {
-
-                        "cube31" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_blue" ],
-                            "position" : [ 0, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube32" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_blue" ],
-                            "position" : [ 10, 0, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube33" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_blue" ],
-                            "position" : [ 10, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        },
-
-                        "cube34" : {
-                            "geometry" : "cube",
-                            "materials": [ "lambert_blue" ],
-                            "position" : [ 0, 10, 0 ],
-                            "rotation" : [ 0, 0, 0 ],
-                            "scale"    : [ 1, 1, 1 ],
-                            "visible"  : true,
-                            "properties" : {
-                                "displayName" : "cube"
-                            }
-                        }
-                    }
-                }
-                
-            }
-            
-        }, 
-
-	"ground" : {
-            "geometry" : "plane",
-            "materials": [ "basic_gray" ],
-            "position" : [ 0, -10, 0 ],
-            "rotation" : [ 0, 0, 0 ],
-            "scale"	   : [ 100, 100, 100 ],
-            "visible"  : true
-	}
-
-    },
-
-    "geometries":
-        {
-	"cube": {
-            "type"  : "cube",
-            "width" : 1,
-            "height": 2,
-            "depth" : 3,
-            "segmentsWidth"  : 1,
-            "segmentsHeight" : 1,
-            "segmentsDepth"  : 1,
-            "flipped" : false,
-            "sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
-	},
-
-	"plane": {
-            "type"   : "plane",
-            "width"  : 10,
-            "height" : 10,
-            "segmentsWidth"  : 50,
-            "segmentsHeight" : 50
-	}
-
-	
-    },
-
-
-
-    "materials":
-        {
-
-	"basic_gray": {
-            "type": "MeshBasicMaterial",
-            "parameters": { "color": 6710886, "wireframe": true }
-	},
-
-	"basic_white": {
-            "type": "MeshBasicMaterial",
-            "parameters": { "color": 16777215, "wireframe": true }
-	},
-
-	"faceted_white": {
-            "type": "MeshLambertMaterial",
-            "parameters": { "color": 16777215, "shading": "flat" }
-	},
-
-	"lambert_red": {
-            "type": "MeshLambertMaterial",
-            "parameters": { "color": 16711680 }
-	},
-
-	"lambert_green": {
-            "type": "MeshLambertMaterial",
-            "parameters": { "color": 30481, "blending": "AdditiveBlending", "transparent": true }
-	},
-
-	"lambert_blue": {
-            "type": "MeshLambertMaterial",
-            "parameters": { "color": 21930 }
-	}
-	
-    },
-
-
-
-    "cameras":
-        {
-	"cam1": {
-            "type"  : "perspective",
-            "fov"   : 50,
-            "aspect": 1.33333,
-            "near"  : 1,
-            "far"   : 1000,
-            "position": [0,0,100],
-            "target"  : [0,0,0]
-	},
-
-	"cam2": {
-            "type"  : "ortho",
-            "left"  : 0,
-            "right" : 1024,
-            "top"   : 0,
-            "bottom": 1024,
-            "near"  : 1,
-            "far"   : 1000,
-            "position": [0,0,0],
-            "target"  : [0,0,0]
-	}
-
-    },
-
-    "lights":
-        {
-	"light1": {
-            "type"		 : "directional",
-            "direction"	 : [0,1,1],
-            "color" 	 : 16777215,
-            "intensity"	 : 0.8
-	},
-
-	"light2": {
-            "type"	  : "point",
-            "position": [0,0,0],
-            "color"   : 16777215
-	}
-
-    },
-
-    "fogs":
-        {
-	"basic": {
-            "type" : "linear",
-            "color": [1,0,0],
-            "near" : 1,
-            "far"  : 1000
-	},
-
-	"exponential": {
-            "type"    : "exp2",
-            "color"   : [1,1,1],
-            "density" : 0.005
-	},
-
-	"black": {
-            "type"    : "exp2",
-            "color"   : [0,0,0],
-            "density" : 0.005
-	}
-    },
-
-    "defaults" :
-        {
-	"bgcolor" : [0,0,0],
-	"bgalpha" : 1,
-	"camera"  : "cam1",
-	"fog"	  : "black"
-    }
-
-}

+ 22 - 3
examples/webgl_loader_scene.html

@@ -169,6 +169,8 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
+			var rotatingObjects = [];
+
 			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 
 			init();
@@ -194,10 +196,10 @@
 
 						if( !material.program ) {
 
-							console.log(m);
 							renderer.initMaterial( material, result.scene.__lights, result.scene.fog );
 
 							count += 1;
+
 							if( count > pieces ) {
 
 								//console.log("xxxxxxxxx");
@@ -275,7 +277,7 @@
 
 				}
 
-				var callbackFinished = function( result ) {
+				var callbackFinished = function ( result ) {
 
 					loaded = result;
 
@@ -297,7 +299,15 @@
 
 					handle_update( result, 1 );
 
-					console.log( result );
+					THREE.SceneUtils.traverseHierarchy( result.scene, function ( child ) {
+
+						if ( child.properties.rotating === true ) {
+
+							rotatingObjects.push( child );
+
+						}
+
+					} );
 
 				}
 
@@ -424,6 +434,15 @@
 
 				camera.lookAt( scene.position );
 
+				for ( var i = 0; i < rotatingObjects.length; i ++ ) {
+
+					var object = rotatingObjects[ i ];
+
+					object.rotation.x += 0.01;
+					object.rotation.y += 0.02;
+
+				}
+
 				renderer.render( scene, camera );
 
 			}

+ 0 - 558
examples/webgl_loader_scene_nested.html

@@ -1,558 +0,0 @@
-<!doctype html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - io - scene loader</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				background:#000;
-				color:#fff;
-				padding:0;
-				margin:0;
-				overflow:hidden;
-				font-family:georgia;
-				text-align:center;
-			}
-
-			#info {
-				position: absolute;
-				top: 0px; width: 100%;
-				padding: 5px;
-				font-family: Monospace;
-				font-size: 13px;
-				text-align: center;
-				z-index:100;
-			}
-
-			#progress {
-				color:red;
-				top:7em;
-				width: 100%;
-				font-size:3em;
-				font-variant:small-caps;
-				font-weight:bold;
-				position:absolute;
-				z-index:100;
-				text-align: center;
-				text-shadow: #000 0px 0px 10px;
-				display:none;
-			}
-
-			#start {
-				color:#fff;
-				text-shadow: #000 0px 0px 2px;
-				padding:0.1em 0.3em;
-				width:3em;
-				text-align: center;
-				display:none;
-			}
-
-			.shadow {
-				-moz-box-shadow: 0px 0px 5px #000;
-				-webkit-box-shadow: 0px 0px 5px #000;
-				box-shadow: 0px 0px 5px #000;
-			}
-
-			#progressbar {
-				text-align: center;
-				background: white;
-				width: 250px;
-				height: 10px;
-			}
-
-			#bar {
-				background:#d00;
-				width:50px;
-				height:10px;
-			}
-
-			.enabled {
-				color: lime!important;
-				cursor:pointer;
-			}
-
-			.enabled:hover {
-				text-shadow: #0f0 0px 0px 5px !important;
-			}
-
-			.disabled {
-				background:gray;
-				cursor:default;
-			}
-
-			a { color:red }
-			canvas { pointer-events:none; z-index:10; }
-
-			#scene_explorer {
-				background:transparent;
-				color:#fff;
-				width:400px;
-				position:absolute;
-				text-align:left;
-				top:0px;
-				z-index:200;
-				overflow:auto;
-			}
-
-			#section_exp {
-				background:rgba(0,0,50,0.5);
-				padding:0.5em 0;
-				display:none;
-			}
-
-			#scene_explorer h3 {
-				font-size:1em;
-				padding:0;
-				margin:0;
-				color:orange;
-			}
-
-			#scene_explorer a {
-				color:#555;
-				font-weight:bold;
-				text-decoration:none;
-				font-size:1.2em;
-				font-family:Monospace;
-			}
-			#scene_explorer a:hover {
-				background:#555;
-				color:rgba(0,0,50,1);
-			}
-
-			.part {
-				display:none;
-				padding:0 0 0.5em 2em;
-			}
-
-		</style>
-	</head>
-
-	<body>
-		<div id="info">
-			<a href="http://github.com/mrdoob/three.js">three.js</a> - scene loader test
-		</div>
-
-		<div id="scene_explorer">
-			<a id="plus_exp" href="#">[+]</a>
-			<div id="section_exp"></div>
-		</div>
-
-		<div id="progress">
-			<span id="message">Loading ...</span>
-
-			<center>
-				<div id="progressbar" class="shadow"><div id="bar" class="shadow"></div></div>
-				<div id="start" class="disabled">Start</div>
-			</center>
-		</div>
-
-		<script src="../build/Three.js"></script>
-
-		<script src="js/Detector.js"></script>
-		<script src="js/Stats.js"></script>
-
-		<script>
-
-			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-
-			var SCREEN_WIDTH = window.innerWidth;
-			var SCREEN_HEIGHT = window.innerHeight;
-
-			var container,stats;
-
-			var camera, scene, loaded;
-			var renderer;
-
-			var mouseX = 0, mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-                        
-                        var stringBuffer="";
-
-
-			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-
-			init();
-			animate();
-
-			function $( id ) {
-
-				return document.getElementById( id );
-
-			}
-
-			function handle_update( result, pieces ) {
-
-				refreshSceneView( result );
-				//renderer.initWebGLObjects( result.scene );
-
-				var m, material, count = 0;
-
-				for ( m in result.materials ) {
-
-					material = result.materials[ m ];
-					if ( ! ( material instanceof THREE.MeshFaceMaterial ) ) {
-
-						if( !material.program ) {
-
-							console.log(m);
-							renderer.initMaterial( material, result.scene.__lights, result.scene.fog );
-
-							count += 1;
-							if( count > pieces ) {
-
-								//console.log("xxxxxxxxx");
-								break;
-
-							}
-
-						}
-
-					}
-
-				}
-
-			}
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				var loadScene = createLoadScene();
-				scene  = loadScene.scene;
-				camera = loadScene.camera;
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-				renderer.domElement.style.position = "relative";
-				container.appendChild( renderer.domElement );
-
-				stats = new Stats();
-				stats.domElement.style.position = 'absolute';
-				stats.domElement.style.top = '0px';
-				stats.domElement.style.right = '0px';
-				stats.domElement.style.zIndex = 100;
-				container.appendChild( stats.domElement );
-
-				$( "start" ).addEventListener( 'click', onStartClick, false );
-
-				var callbackProgress = function( progress, result ) {
-
-					var bar = 250,
-						total = progress.totalModels + progress.totalTextures,
-						loaded = progress.loadedModels + progress.loadedTextures;
-
-					if ( total )
-						bar = Math.floor( bar * loaded / total );
-
-					$( "bar" ).style.width = bar + "px";
-
-					count = 0;
-					for ( var m in result.materials ) count++;
-
-					handle_update( result, Math.floor( count/total ) );
-
-				}
-
-				var callbackSync = function( result ) {
-
-					/*
-
-					// uncomment to see progressive scene loading
-
-					scene = result.scene;
-					camera = result.currentCamera;
-
-					camera.aspect = window.innerWidth / window.innerHeight;
-					camera.updateProjectionMatrix();
-
-					renderer.setClearColor( result.bgColor, result.bgAlpha );
-
-					*/
-
-					//handle_update( result, 1 );
-
-				}
-
-				var callbackFinished = function( result ) {
-
-					loaded = result;
-
-					
-
-					$( "message" ).style.display = "none";
-					$( "progressbar" ).style.display = "none";
-					$( "start" ).style.display = "block";
-					$( "start" ).className = "enabled";
-
-					handle_update( result, 1 );
-
-					console.log( result );
-
-				}
-
-				$( "progress" ).style.display = "block";
-
-				var loader = new THREE.SceneLoader();
-
-				loader.callbackSync = callbackSync;
-				loader.callbackProgress = callbackProgress;
-
-				loader.load( "scenes/test_scene_nested.js", callbackFinished );
-
-				$( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false );
-
-			}
-
-			function setButtonActive( id ) {
-
-				$( "start" ).style.backgroundColor = "green";
-
-			}
-
-			function onStartClick() {
-
-				$( "progress" ).style.display = "none";
-
-				scene = loaded.scene;
-				camera = loaded.currentCamera;
-
-				scene.add( camera );
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setClearColor( loaded.bgColor, loaded.bgAlpha );
-
-			}
-
-			function onDocumentMouseMove(event) {
-
-				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY );
-
-			}
-
-			function createLoadScene() {
-
-				var result = {
-
-					scene:  new THREE.Scene(),
-					camera: new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 )
-
-				};
-
-				result.camera.position.z = 100;
-				result.scene.add( result.camera );
-
-				var object, geometry, material, light, count = 500, range = 200;
-
-				material = new THREE.MeshLambertMaterial( { color:0xffffff } );
-				geometry = new THREE.CubeGeometry( 5, 5, 5 );
-
-				for( var i = 0; i < count; i++ ) {
-
-					object = new THREE.Mesh( geometry, material );
-
-					object.position.x = ( Math.random() - 0.5 ) * range;
-					object.position.y = ( Math.random() - 0.5 ) * range;
-					object.position.z = ( Math.random() - 0.5 ) * range;
-
-					object.rotation.x = Math.random() * 6;
-					object.rotation.y = Math.random() * 6;
-					object.rotation.z = Math.random() * 6;
-
-					object.matrixAutoUpdate = false;
-					object.updateMatrix();
-
-					result.scene.add( object );
-
-				}
-
-				result.scene.matrixAutoUpdate = false;
-
-				light = new THREE.PointLight( 0xffffff );
-				result.scene.add( light );
-
-				light = new THREE.DirectionalLight( 0x111111 );
-				light.position.x = 1;
-				result.scene.add( light );
-
-				return result;
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				stats.update();
-
-			}
-
-			function render() {
-
-				camera.position.x += ( mouseX - camera.position.x ) * .001;
-				camera.position.y += ( - mouseY - camera.position.y ) * .001;
-
-				camera.lookAt( scene.position );
-
-				renderer.render( scene, camera );
-
-			}
-
-			// Scene explorer user interface
-
-			function toggle( id ) {
-
-				var scn = $( "section_" + id ).style,
-					btn = $( "plus_" + id );
-
-				if ( scn.display == "block" ) {
-
-					scn.display = "none";
-					btn.innerHTML = "[+]";
-
-				}
-				else {
-
-					scn.display = "block";
-					btn.innerHTML = "[-]";
-
-				}
-
-			}
-
-			function createToggle( label ) { return function() { toggle( label ) } };
-
-			function refreshSceneView( result ) {
-
-				$( "section_exp" ).innerHTML = generateSceneView( result );
-                                var config = [ "obj", "geo", "mat", "tex", "lit", "cam" , "sc"];
-				
-				for ( var i = 0; i < config.length; i++ ) {
-					$( "plus_" + config[i] ).addEventListener( 'click', createToggle( config[i] ), false );
-                                        console.log( config[i]);
-                                }
-
-			}
-
-			function generateSection( label, id, objects ) {
-
-				var html = "";
-
-				html += "<h3><a id='plus_" + id + "' href='#'>[+]</a> " + label + "</h3>";
-				html += "<div id='section_" + id + "' class='part'>";
-
-				for( var o in objects ) {
-
-					html += o + "<br/>";
-
-				}
-				html += "</div>";
-
-				return html;
-
-			}
-                        
-                        function generateScene( scene ) {
-                            
-                            var html = "";
-
-                            var label = "Scene Graph";
-                            var id ="sc";
-                            html += "<h3><a id='plus_" + id + "' href='#'>[+]</a> " + label + "</h3>";
-                            html += "<div id='section_" + id + "' class='part'>";
-                                                      
-                            stringBuffer = "";
-                            renderNode( scene, 1 );
-                            
-                            html += stringBuffer;
-                                             
-                            html += "</div>";
-
-                            return html;
-                        }
-                        
-                        function renderNode( root, depth ) {
-                            console.log("renderNode", root, depth);
-                            var n, i, l = root.children.length;
-                            
-                            var indent = depth.toString() + "&nbsp;"
-                            for ( i = 0; i < depth; i++) {
-                                indent +="&nbsp;&nbsp;&nbsp;&nbsp;"
-                            }
-                                                    
-                            for ( i = 0; i < l; i ++ ) {
-
-                                n = root.children[ i ];
-                                stringBuffer += indent;
-                                stringBuffer += n.id.toString();
-                                stringBuffer += " ";
-                                
-                                if ( n.name != undefined && n.name != '') {
-                                    stringBuffer += n.name;
-                                } else if ( n instanceof THREE.DirectionalLight) {
-                                    stringBuffer +="THREE.DirectionalLight";
-                                } else if ( n instanceof THREE.PointLight ) {
-                                    stringBuffer +="THREE.PointLight";
-                                }
-        
-                                
-                                if ( n.properties !== undefined)  {  
-                                    stringBuffer += "{ ";
-                                    for ( var key in n.properties ) {                                    
-                                        var value = n.properties[ key];                                    
-                                        stringBuffer += key;
-                                        stringBuffer += ":";
-                                        stringBuffer += value;
-                                        }
-                                    
-                                    stringBuffer += "}";
-                                }
-                                
-                                stringBuffer +="<br/>";
-
-                                
-                                renderNode( n , depth +1);
-                                
-
-                            }
-                            
-                           
-                        }                        
-
-			function generateSceneView( result ) {
-
-				var config = [
-				[ "Objects",    "obj", result.objects ],
-				[ "Geometries", "geo", result.geometries ],
-				[ "Materials",  "mat", result.materials ],
-				[ "Textures",   "tex", result.textures ],
-				[ "Lights",     "lit", result.lights ],
-				[ "Cameras",    "cam", result.cameras ]
-				];
-
-				var html = "";
-
-				for ( var i = 0; i < config.length; i++ )
-					html += generateSection( config[i][0], config[i][1], config[i][2] );
-                                
-                                
-                                html += generateScene( result.scene);
-                        
-
-				return html;
-
-			}
-
-		</script>
-
-	</body>
-</html>

+ 1 - 2
src/core/Object3D.js

@@ -9,6 +9,7 @@ THREE.Object3D = function () {
 	this.id = THREE.Object3DCount ++;
 
 	this.name = '';
+	this.properties = {};
 
 	this.parent = undefined;
 	this.children = [];
@@ -45,8 +46,6 @@ THREE.Object3D = function () {
 	this.frustumCulled = true;
 
 	this._vector = new THREE.Vector3();
-        
-        this.properties = {};
 
 };
 

+ 11 - 11
src/loaders/SceneLoader.js

@@ -271,17 +271,17 @@ THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url
 					result.empties[ dd ] = object;
 
 				}
-                                
-                                // Copy attributes from json to scene object
-                                if ( o.properties !== undefined)  {
-                                    
-                                    for ( var key in o.properties ) {                                    
-                                        var value = o.properties[ key];                                    
-                                        object.properties[ key ] = value;
-                                    }
-                                }
-
-				// recursive descend if necessary
+
+				if ( o.properties !== undefined)  {
+
+					for ( var key in o.properties ) {
+
+						var value = o.properties[ key ];
+						object.properties[ key ] = value;
+
+					}
+				}
+
 				if ( o.children !== undefined ) {
 
 					handle_children( object, o.children );