|
@@ -37,135 +37,180 @@ Menubar.Add = function ( editor ) {
|
|
|
|
|
|
options.add( new UI.HorizontalRule() );
|
|
|
|
|
|
- // Plane
|
|
|
+ // Box
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/plane' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/box' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.PlaneBufferGeometry( 1, 1, 1, 1 );
|
|
|
- var material = new THREE.MeshStandardMaterial();
|
|
|
- var mesh = new THREE.Mesh( geometry, material );
|
|
|
- mesh.name = 'Plane';
|
|
|
+ var geometry = new THREE.BoxBufferGeometry( 1, 1, 1, 1, 1, 1 );
|
|
|
+ var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ mesh.name = 'Box';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Box
|
|
|
+ // Circle
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/box' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/circle' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.BoxBufferGeometry( 1, 1, 1, 1, 1, 1 );
|
|
|
+ var geometry = new THREE.CircleBufferGeometry( 1, 8, 0, Math.PI * 2 );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Box';
|
|
|
+ mesh.name = 'Circle';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Circle
|
|
|
+ // Cylinder
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/circle' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.CircleBufferGeometry( 1, 8, 0, Math.PI * 2 );
|
|
|
+ var geometry = new THREE.CylinderBufferGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Circle';
|
|
|
+ mesh.name = 'Cylinder';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Ring
|
|
|
+ // Icosahedron
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/ring' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.RingBufferGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
|
|
|
+ var geometry = new THREE.IcosahedronBufferGeometry( 1, 0 );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Ring';
|
|
|
+ mesh.name = 'Icosahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Cylinder
|
|
|
+ // Lathe
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/lathe' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.CylinderBufferGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Cylinder';
|
|
|
+ var points = [
|
|
|
+ new THREE.Vector2( 0, 0 ),
|
|
|
+ new THREE.Vector2( 0.4, 0 ),
|
|
|
+ new THREE.Vector2( 0.35, 0.05 ),
|
|
|
+ new THREE.Vector2( 0.1, 0.075 ),
|
|
|
+ new THREE.Vector2( 0.08, 0.1 ),
|
|
|
+ new THREE.Vector2( 0.08, 0.4 ),
|
|
|
+ new THREE.Vector2( 0.1, 0.42 ),
|
|
|
+ new THREE.Vector2( 0.14, 0.48 ),
|
|
|
+ new THREE.Vector2( 0.2, 0.5 ),
|
|
|
+ new THREE.Vector2( 0.25, 0.54 ),
|
|
|
+ new THREE.Vector2( 0.3, 1.2 )
|
|
|
+ ];
|
|
|
+
|
|
|
+ var geometry = new THREE.LatheBufferGeometry( points, 12, 0, Math.PI * 2 );
|
|
|
+ var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
|
|
|
+ mesh.name = 'Lathe';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Sphere
|
|
|
+ // Octahedron
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/sphere' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/octahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.SphereBufferGeometry( 1, 8, 6, 0, Math.PI * 2, 0, Math.PI );
|
|
|
+ var geometry = new THREE.OctahedronBufferGeometry( 1, 0 );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Sphere';
|
|
|
+ mesh.name = 'Octahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Icosahedron
|
|
|
+ // Plane
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/plane' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.IcosahedronBufferGeometry( 1, 0 );
|
|
|
+ var geometry = new THREE.PlaneBufferGeometry( 1, 1, 1, 1 );
|
|
|
+ var material = new THREE.MeshStandardMaterial();
|
|
|
+ var mesh = new THREE.Mesh( geometry, material );
|
|
|
+ mesh.name = 'Plane';
|
|
|
+
|
|
|
+ editor.execute( new AddObjectCommand( mesh ) );
|
|
|
+
|
|
|
+ } );
|
|
|
+ options.add( option )
|
|
|
+
|
|
|
+ // Ring
|
|
|
+
|
|
|
+ var option = new UI.Row();
|
|
|
+ option.setClass( 'option' );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/ring' ) );
|
|
|
+ option.onClick( function () {
|
|
|
+
|
|
|
+ var geometry = new THREE.RingBufferGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Icosahedron';
|
|
|
+ mesh.name = 'Ring';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // Octahedron
|
|
|
+ // Sphere
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/octahedron' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/sphere' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.OctahedronBufferGeometry( 1, 0 );
|
|
|
+ var geometry = new THREE.SphereBufferGeometry( 1, 8, 6, 0, Math.PI * 2, 0, Math.PI );
|
|
|
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
- mesh.name = 'Octahedron';
|
|
|
+ mesh.name = 'Sphere';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( mesh ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
+ // Sprite
|
|
|
+
|
|
|
+ var option = new UI.Row();
|
|
|
+ option.setClass( 'option' );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/sprite' ) );
|
|
|
+ option.onClick( function () {
|
|
|
+
|
|
|
+ var sprite = new THREE.Sprite( new THREE.SpriteMaterial() );
|
|
|
+ sprite.name = 'Sprite';
|
|
|
+
|
|
|
+ editor.execute( new AddObjectCommand( sprite ) );
|
|
|
+
|
|
|
+ } );
|
|
|
+ options.add( option );
|
|
|
+
|
|
|
// Tetrahedron
|
|
|
|
|
|
var option = new UI.Row();
|
|
@@ -266,90 +311,40 @@ Menubar.Add = function ( editor ) {
|
|
|
options.add( option );
|
|
|
*/
|
|
|
|
|
|
- // Lathe
|
|
|
-
|
|
|
- var option = new UI.Row();
|
|
|
- option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/lathe' ) );
|
|
|
- option.onClick( function () {
|
|
|
-
|
|
|
- var points = [
|
|
|
- new THREE.Vector2( 0, 0 ),
|
|
|
- new THREE.Vector2( 0.4, 0 ),
|
|
|
- new THREE.Vector2( 0.35, 0.05 ),
|
|
|
- new THREE.Vector2( 0.1, 0.075 ),
|
|
|
- new THREE.Vector2( 0.08, 0.1 ),
|
|
|
- new THREE.Vector2( 0.08, 0.4 ),
|
|
|
- new THREE.Vector2( 0.1, 0.42 ),
|
|
|
- new THREE.Vector2( 0.14, 0.48 ),
|
|
|
- new THREE.Vector2( 0.2, 0.5 ),
|
|
|
- new THREE.Vector2( 0.25, 0.54 ),
|
|
|
- new THREE.Vector2( 0.3, 1.2 )
|
|
|
- ];
|
|
|
-
|
|
|
- var geometry = new THREE.LatheBufferGeometry( points, 12, 0, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
|
|
|
- mesh.name = 'Lathe';
|
|
|
-
|
|
|
- editor.execute( new AddObjectCommand( mesh ) );
|
|
|
-
|
|
|
- } );
|
|
|
- options.add( option );
|
|
|
-
|
|
|
- // Sprite
|
|
|
-
|
|
|
- var option = new UI.Row();
|
|
|
- option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/sprite' ) );
|
|
|
- option.onClick( function () {
|
|
|
-
|
|
|
- var sprite = new THREE.Sprite( new THREE.SpriteMaterial() );
|
|
|
- sprite.name = 'Sprite';
|
|
|
-
|
|
|
- editor.execute( new AddObjectCommand( sprite ) );
|
|
|
-
|
|
|
- } );
|
|
|
- options.add( option );
|
|
|
-
|
|
|
//
|
|
|
|
|
|
options.add( new UI.HorizontalRule() );
|
|
|
|
|
|
- // PointLight
|
|
|
+ // AmbientLight
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/pointlight' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/ambientlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0xffffff;
|
|
|
- var intensity = 1;
|
|
|
- var distance = 0;
|
|
|
+ var color = 0x222222;
|
|
|
|
|
|
- var light = new THREE.PointLight( color, intensity, distance );
|
|
|
- light.name = 'PointLight';
|
|
|
+ var light = new THREE.AmbientLight( color );
|
|
|
+ light.name = 'AmbientLight';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( light ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // SpotLight
|
|
|
+ // DirectionalLight
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/spotlight' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/directionallight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
var color = 0xffffff;
|
|
|
var intensity = 1;
|
|
|
- var distance = 0;
|
|
|
- var angle = Math.PI * 0.1;
|
|
|
- var penumbra = 0;
|
|
|
|
|
|
- var light = new THREE.SpotLight( color, intensity, distance, angle, penumbra );
|
|
|
- light.name = 'SpotLight';
|
|
|
- light.target.name = 'SpotLight Target';
|
|
|
+ var light = new THREE.DirectionalLight( color, intensity );
|
|
|
+ light.name = 'DirectionalLight';
|
|
|
+ light.target.name = 'DirectionalLight Target';
|
|
|
|
|
|
light.position.set( 5, 10, 7.5 );
|
|
|
|
|
@@ -358,59 +353,64 @@ Menubar.Add = function ( editor ) {
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // DirectionalLight
|
|
|
+ // HemisphereLight
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/directionallight' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/hemispherelight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0xffffff;
|
|
|
+ var skyColor = 0x00aaff;
|
|
|
+ var groundColor = 0xffaa00;
|
|
|
var intensity = 1;
|
|
|
|
|
|
- var light = new THREE.DirectionalLight( color, intensity );
|
|
|
- light.name = 'DirectionalLight';
|
|
|
- light.target.name = 'DirectionalLight Target';
|
|
|
+ var light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
|
|
|
+ light.name = 'HemisphereLight';
|
|
|
|
|
|
- light.position.set( 5, 10, 7.5 );
|
|
|
+ light.position.set( 0, 10, 0 );
|
|
|
|
|
|
editor.execute( new AddObjectCommand( light ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // HemisphereLight
|
|
|
+ // PointLight
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/hemispherelight' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/pointlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var skyColor = 0x00aaff;
|
|
|
- var groundColor = 0xffaa00;
|
|
|
+ var color = 0xffffff;
|
|
|
var intensity = 1;
|
|
|
+ var distance = 0;
|
|
|
|
|
|
- var light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
|
|
|
- light.name = 'HemisphereLight';
|
|
|
-
|
|
|
- light.position.set( 0, 10, 0 );
|
|
|
+ var light = new THREE.PointLight( color, intensity, distance );
|
|
|
+ light.name = 'PointLight';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( light ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // AmbientLight
|
|
|
+ // SpotLight
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/ambientlight' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/spotlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0x222222;
|
|
|
+ var color = 0xffffff;
|
|
|
+ var intensity = 1;
|
|
|
+ var distance = 0;
|
|
|
+ var angle = Math.PI * 0.1;
|
|
|
+ var penumbra = 0;
|
|
|
|
|
|
- var light = new THREE.AmbientLight( color );
|
|
|
- light.name = 'AmbientLight';
|
|
|
+ var light = new THREE.SpotLight( color, intensity, distance, angle, penumbra );
|
|
|
+ light.name = 'SpotLight';
|
|
|
+ light.target.name = 'SpotLight Target';
|
|
|
+
|
|
|
+ light.position.set( 5, 10, 7.5 );
|
|
|
|
|
|
editor.execute( new AddObjectCommand( light ) );
|
|
|
|
|
@@ -421,30 +421,30 @@ Menubar.Add = function ( editor ) {
|
|
|
|
|
|
options.add( new UI.HorizontalRule() );
|
|
|
|
|
|
- // PerspectiveCamera
|
|
|
+ // OrthographicCamera
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/perspectivecamera' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/orthographiccamera' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var camera = new THREE.PerspectiveCamera();
|
|
|
- camera.name = 'PerspectiveCamera';
|
|
|
+ var camera = new THREE.OrthographicCamera();
|
|
|
+ camera.name = 'OrthographicCamera';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( camera ) );
|
|
|
|
|
|
} );
|
|
|
options.add( option );
|
|
|
|
|
|
- // OrthographicCamera
|
|
|
+ // PerspectiveCamera
|
|
|
|
|
|
var option = new UI.Row();
|
|
|
option.setClass( 'option' );
|
|
|
- option.setTextContent( strings.getKey( 'menubar/add/orthographiccamera' ) );
|
|
|
+ option.setTextContent( strings.getKey( 'menubar/add/perspectivecamera' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var camera = new THREE.OrthographicCamera();
|
|
|
- camera.name = 'OrthographicCamera';
|
|
|
+ var camera = new THREE.PerspectiveCamera();
|
|
|
+ camera.name = 'PerspectiveCamera';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( camera ) );
|
|
|
|