Browse Source

Editor: fixed object names in outliner. Added names for some default objects.

alteredq 12 years ago
parent
commit
f6cd125010

+ 2 - 0
build/three.js

@@ -6396,6 +6396,7 @@ THREE.DirectionalLight = function ( hex, intensity, distance ) {
 
 	this.position = new THREE.Vector3( 0, 1, 0 );
 	this.target = new THREE.Object3D();
+	this.target.name = "Light target";
 
 	this.intensity = ( intensity !== undefined ) ? intensity : 1;
 	this.distance = ( distance !== undefined ) ? distance : 0;
@@ -6489,6 +6490,7 @@ THREE.SpotLight = function ( hex, intensity, distance, angle, exponent ) {
 
 	this.position = new THREE.Vector3( 0, 1, 0 );
 	this.target = new THREE.Object3D();
+	this.target.name = "Light target";
 
 	this.intensity = ( intensity !== undefined ) ? intensity : 1;
 	this.distance = ( distance !== undefined ) ? distance : 0;

+ 4 - 4
build/three.min.js

@@ -135,11 +135,11 @@ THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
-!1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.target.name="Light target";this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=
+this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
 THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);
-THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
-this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.target.name="Light target";this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=
+512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,r){var t=f.toLowerCase().endsWith(".dds"),u=b+"/"+f;if(t){var v=THREE.ImageUtils.loadCompressedTexture(u);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,

+ 1 - 0
editor/index.html

@@ -311,6 +311,7 @@
 			var geometry = new THREE.SphereGeometry( 75, 25, 15 );
 			var material = new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff, map: dummyTexture } );
 			var mesh = new THREE.Mesh( geometry, material );
+			mesh.name = "Sphere";
 
 			signals.objectAdded.dispatch( mesh );
 			signals.objectSelected.dispatch( mesh );

+ 1 - 1
editor/js/ui/Sidebar.Outliner.js

@@ -75,7 +75,7 @@ Sidebar.Outliner = function ( signals ) {
 
 				var child = object.children[ key ];
 
-				options[ child.id ] = pad + '+ ' + object.name + ' [' + getObjectInstanceName( child ) + ']';
+				options[ child.id ] = pad + '+ ' + child.name + ' [' + getObjectInstanceName( child ) + ']';
 
 				createList( child, pad + '&nbsp;&nbsp;&nbsp;' );
 

+ 15 - 11
editor/js/ui/Viewport.js

@@ -66,10 +66,14 @@ var Viewport = function ( signals ) {
 	light.position.set( 1, 0.5, 0 ).normalize();
 	scene.add( light );
 
+	light.name = "Directional light #1";
+
 	var light = new THREE.DirectionalLight( 0xffffff, 0.5 );
 	light.position.set( - 1, - 0.5, 0 ).normalize();
 	scene.add( light );
 
+	light.name = "Directional light #2";
+
 	signals.sceneChanged.dispatch( scene );
 
 	// object picking
@@ -77,7 +81,7 @@ var Viewport = function ( signals ) {
 	var intersectionPlane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ) );
 	intersectionPlane.visible = false;
 	sceneHelpers.add( intersectionPlane );
-	
+
 	var ray = new THREE.Ray();
 	var projector = new THREE.Projector();
 	var offset = new THREE.Vector3();
@@ -92,7 +96,7 @@ var Viewport = function ( signals ) {
 			- ( ( event.clientY - container.dom.offsetTop ) / container.dom.offsetHeight ) * 2 + 1,
 			0.5
 		);
-		
+
 		projector.unprojectVector( vector, camera );
 
 		ray.set( camera.position, vector.subSelf( camera.position ).normalize() );
@@ -111,9 +115,9 @@ var Viewport = function ( signals ) {
 			offset.copy( intersects[ 0 ].point ).subSelf( intersectionPlane.position );
 
 		} else {
-			
+
 			controls.enabled = true;
-			
+
 		}
 
 	}, false );
@@ -129,25 +133,25 @@ var Viewport = function ( signals ) {
 		projector.unprojectVector( vector, camera );
 
 		ray.set( camera.position, vector.subSelf( camera.position ).normalize() );
-		
+
 		if ( picked ) {
 
 			var intersects = ray.intersectObject( intersectionPlane );
-			
+
 			if ( intersects.length > 0 ) {
-			
+
 				picked.position.copy( intersects[ 0 ].point.subSelf( offset ) );
-				
+
 				signals.objectChanged.dispatch( picked );
 
 				render();
 
 			}
-			
+
 			return;
 
 		}
-		
+
 		var intersects = ray.intersectObjects( objects, true );
 
 		if ( intersects.length > 0 ) {
@@ -162,7 +166,7 @@ var Viewport = function ( signals ) {
 	container.dom.addEventListener( 'mouseup', function ( event ) {
 
 		picked = false;
-		
+
 		controls.enabled = true;
 
 		var vector = new THREE.Vector3(

+ 1 - 0
src/lights/DirectionalLight.js

@@ -9,6 +9,7 @@ THREE.DirectionalLight = function ( hex, intensity, distance ) {
 
 	this.position = new THREE.Vector3( 0, 1, 0 );
 	this.target = new THREE.Object3D();
+	this.target.name = "Light target";
 
 	this.intensity = ( intensity !== undefined ) ? intensity : 1;
 	this.distance = ( distance !== undefined ) ? distance : 0;

+ 1 - 0
src/lights/SpotLight.js

@@ -8,6 +8,7 @@ THREE.SpotLight = function ( hex, intensity, distance, angle, exponent ) {
 
 	this.position = new THREE.Vector3( 0, 1, 0 );
 	this.target = new THREE.Object3D();
+	this.target.name = "Light target";
 
 	this.intensity = ( intensity !== undefined ) ? intensity : 1;
 	this.distance = ( distance !== undefined ) ? distance : 0;