Browse Source

Editor: Changed scale to SI units. See #7609

Mr.doob 9 years ago
parent
commit
2631fb6892
3 changed files with 28 additions and 42 deletions
  1. 9 9
      editor/js/Editor.js
  2. 18 32
      editor/js/Menubar.Add.js
  3. 1 1
      editor/js/Viewport.js

+ 9 - 9
editor/js/Editor.js

@@ -74,8 +74,8 @@ var Editor = function () {
 	this.storage = new Storage();
 	this.storage = new Storage();
 	this.loader = new Loader( this );
 	this.loader = new Loader( this );
 
 
-	this.camera = new THREE.PerspectiveCamera( 50, 1, 1, 100000 );
-	this.camera.position.set( 500, 250, 500 );
+	this.camera = new THREE.PerspectiveCamera( 50, 1, 1, 10000 );
+	this.camera.position.set( 20, 10, 20 );
 	this.camera.lookAt( new THREE.Vector3() );
 	this.camera.lookAt( new THREE.Vector3() );
 	this.camera.name = 'Camera';
 	this.camera.name = 'Camera';
 
 
@@ -236,7 +236,7 @@ Editor.prototype = {
 
 
 	addHelper: function () {
 	addHelper: function () {
 
 
-		var geometry = new THREE.SphereBufferGeometry( 20, 4, 2 );
+		var geometry = new THREE.SphereBufferGeometry( 2, 4, 2 );
 		var material = new THREE.MeshBasicMaterial( { color: 0xff0000, visible: false } );
 		var material = new THREE.MeshBasicMaterial( { color: 0xff0000, visible: false } );
 
 
 		return function ( object ) {
 		return function ( object ) {
@@ -245,23 +245,23 @@ Editor.prototype = {
 
 
 			if ( object instanceof THREE.Camera ) {
 			if ( object instanceof THREE.Camera ) {
 
 
-				helper = new THREE.CameraHelper( object, 10 );
+				helper = new THREE.CameraHelper( object, 1 );
 
 
 			} else if ( object instanceof THREE.PointLight ) {
 			} else if ( object instanceof THREE.PointLight ) {
 
 
-				helper = new THREE.PointLightHelper( object, 10 );
+				helper = new THREE.PointLightHelper( object, 1 );
 
 
 			} else if ( object instanceof THREE.DirectionalLight ) {
 			} else if ( object instanceof THREE.DirectionalLight ) {
 
 
-				helper = new THREE.DirectionalLightHelper( object, 20 );
+				helper = new THREE.DirectionalLightHelper( object, 1 );
 
 
 			} else if ( object instanceof THREE.SpotLight ) {
 			} else if ( object instanceof THREE.SpotLight ) {
 
 
-				helper = new THREE.SpotLightHelper( object, 10 );
+				helper = new THREE.SpotLightHelper( object, 1 );
 
 
 			} else if ( object instanceof THREE.HemisphereLight ) {
 			} else if ( object instanceof THREE.HemisphereLight ) {
 
 
-				helper = new THREE.HemisphereLightHelper( object, 10 );
+				helper = new THREE.HemisphereLightHelper( object, 1 );
 
 
 			} else if ( object instanceof THREE.SkinnedMesh ) {
 			} else if ( object instanceof THREE.SkinnedMesh ) {
 
 
@@ -408,7 +408,7 @@ Editor.prototype = {
 		this.history.clear();
 		this.history.clear();
 		this.storage.clear();
 		this.storage.clear();
 
 
-		this.camera.position.set( 500, 250, 500 );
+		this.camera.position.set( 20, 10, 20 );
 		this.camera.lookAt( new THREE.Vector3() );
 		this.camera.lookAt( new THREE.Vector3() );
 
 
 		var objects = this.scene.children;
 		var objects = this.scene.children;

+ 18 - 32
editor/js/Menubar.Add.js

@@ -56,13 +56,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Plane' );
 	option.setTextContent( 'Plane' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var width = 200;
-		var height = 200;
-
-		var widthSegments = 1;
-		var heightSegments = 1;
-
-		var geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments );
+		var geometry = new THREE.PlaneGeometry( 2, 2 );
 		var material = new THREE.MeshStandardMaterial();
 		var material = new THREE.MeshStandardMaterial();
 		var mesh = new THREE.Mesh( geometry, material );
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.name = 'Plane ' + ( ++ meshCount );
 		mesh.name = 'Plane ' + ( ++ meshCount );
@@ -79,15 +73,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Box' );
 	option.setTextContent( 'Box' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var width = 100;
-		var height = 100;
-		var depth = 100;
-
-		var widthSegments = 1;
-		var heightSegments = 1;
-		var depthSegments = 1;
-
-		var geometry = new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );
+		var geometry = new THREE.BoxGeometry( 1, 1, 1 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Box ' + ( ++ meshCount );
 		mesh.name = 'Box ' + ( ++ meshCount );
 
 
@@ -103,7 +89,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Circle' );
 	option.setTextContent( 'Circle' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radius = 20;
+		var radius = 1;
 		var segments = 32;
 		var segments = 32;
 
 
 		var geometry = new THREE.CircleGeometry( radius, segments );
 		var geometry = new THREE.CircleGeometry( radius, segments );
@@ -122,9 +108,9 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Cylinder' );
 	option.setTextContent( 'Cylinder' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radiusTop = 20;
-		var radiusBottom = 20;
-		var height = 100;
+		var radiusTop = 1;
+		var radiusBottom = 1;
+		var height = 2;
 		var radiusSegments = 32;
 		var radiusSegments = 32;
 		var heightSegments = 1;
 		var heightSegments = 1;
 		var openEnded = false;
 		var openEnded = false;
@@ -145,7 +131,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Sphere' );
 	option.setTextContent( 'Sphere' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radius = 75;
+		var radius = 1;
 		var widthSegments = 32;
 		var widthSegments = 32;
 		var heightSegments = 16;
 		var heightSegments = 16;
 		var phiStart = 0;
 		var phiStart = 0;
@@ -169,7 +155,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Icosahedron' );
 	option.setTextContent( 'Icosahedron' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radius = 75;
+		var radius = 1;
 		var detail = 2;
 		var detail = 2;
 
 
 		var geometry = new THREE.IcosahedronGeometry( radius, detail );
 		var geometry = new THREE.IcosahedronGeometry( radius, detail );
@@ -188,10 +174,10 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Torus' );
 	option.setTextContent( 'Torus' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radius = 100;
-		var tube = 40;
-		var radialSegments = 8;
-		var tubularSegments = 6;
+		var radius = 2;
+		var tube = 1;
+		var radialSegments = 32;
+		var tubularSegments = 12;
 		var arc = Math.PI * 2;
 		var arc = Math.PI * 2;
 
 
 		var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
 		var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
@@ -210,10 +196,10 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'TorusKnot' );
 	option.setTextContent( 'TorusKnot' );
 	option.onClick( function () {
 	option.onClick( function () {
 
 
-		var radius = 100;
-		var tube = 40;
+		var radius = 2;
+		var tube = 0.8;
 		var radialSegments = 64;
 		var radialSegments = 64;
-		var tubularSegments = 8;
+		var tubularSegments = 12;
 		var p = 2;
 		var p = 2;
 		var q = 3;
 		var q = 3;
 		var heightScale = 1;
 		var heightScale = 1;
@@ -311,7 +297,7 @@ Menubar.Add = function ( editor ) {
 		light.name = 'SpotLight ' + ( ++ lightCount );
 		light.name = 'SpotLight ' + ( ++ lightCount );
 		light.target.name = 'SpotLight ' + ( lightCount ) + ' Target';
 		light.target.name = 'SpotLight ' + ( lightCount ) + ' Target';
 
 
-		light.position.set( 0.5, 1, 0.75 ).multiplyScalar( 200 );
+		light.position.set( 5, 10, 7.5 );
 
 
 		editor.execute( new AddObjectCommand( light ) );
 		editor.execute( new AddObjectCommand( light ) );
 
 
@@ -332,7 +318,7 @@ Menubar.Add = function ( editor ) {
 		light.name = 'DirectionalLight ' + ( ++ lightCount );
 		light.name = 'DirectionalLight ' + ( ++ lightCount );
 		light.target.name = 'DirectionalLight ' + ( lightCount ) + ' Target';
 		light.target.name = 'DirectionalLight ' + ( lightCount ) + ' Target';
 
 
-		light.position.set( 0.5, 1, 0.75 ).multiplyScalar( 200 );
+		light.position.set( 5, 10, 7.5 );
 
 
 		editor.execute( new AddObjectCommand( light ) );
 		editor.execute( new AddObjectCommand( light ) );
 
 
@@ -353,7 +339,7 @@ Menubar.Add = function ( editor ) {
 		var light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
 		var light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
 		light.name = 'HemisphereLight ' + ( ++ lightCount );
 		light.name = 'HemisphereLight ' + ( ++ lightCount );
 
 
-		light.position.set( 0, 100, 0 );
+		light.position.set( 0, 10, 0 );
 
 
 		editor.execute( new AddObjectCommand( light ) );
 		editor.execute( new AddObjectCommand( light ) );
 
 

+ 1 - 1
editor/js/Viewport.js

@@ -19,7 +19,7 @@ var Viewport = function ( editor ) {
 
 
 	// helpers
 	// helpers
 
 
-	var grid = new THREE.GridHelper( 500, 25 );
+	var grid = new THREE.GridHelper( 30, 1 );
 	sceneHelpers.add( grid );
 	sceneHelpers.add( grid );
 
 
 	//
 	//