|
@@ -6,28 +6,28 @@ import { AddObjectCommand } from './commands/AddObjectCommand.js';
|
|
|
|
|
|
function MenubarAdd( editor ) {
|
|
|
|
|
|
- var strings = editor.strings;
|
|
|
+ const strings = editor.strings;
|
|
|
|
|
|
- var container = new UIPanel();
|
|
|
+ const container = new UIPanel();
|
|
|
container.setClass( 'menu' );
|
|
|
|
|
|
- var title = new UIPanel();
|
|
|
+ const title = new UIPanel();
|
|
|
title.setClass( 'title' );
|
|
|
title.setTextContent( strings.getKey( 'menubar/add' ) );
|
|
|
container.add( title );
|
|
|
|
|
|
- var options = new UIPanel();
|
|
|
+ const options = new UIPanel();
|
|
|
options.setClass( 'options' );
|
|
|
container.add( options );
|
|
|
|
|
|
// Group
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ let option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/group' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var mesh = new THREE.Group();
|
|
|
+ const mesh = new THREE.Group();
|
|
|
mesh.name = 'Group';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -41,13 +41,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Box
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/box' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.BoxGeometry( 1, 1, 1, 1, 1, 1 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.BoxGeometry( 1, 1, 1, 1, 1, 1 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Box';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -57,13 +57,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Circle
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/circle' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.CircleGeometry( 1, 8, 0, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.CircleGeometry( 1, 8, 0, Math.PI * 2 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Circle';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -73,13 +73,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Cylinder
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.CylinderGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.CylinderGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Cylinder';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -89,13 +89,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Dodecahedron
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/dodecahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.DodecahedronGeometry( 1, 0 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.DodecahedronGeometry( 1, 0 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Dodecahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -105,13 +105,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Icosahedron
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.IcosahedronGeometry( 1, 0 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.IcosahedronGeometry( 1, 0 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Icosahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -121,13 +121,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Lathe
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/lathe' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.LatheGeometry();
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
|
|
|
+ const geometry = new THREE.LatheGeometry();
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
|
|
|
mesh.name = 'Lathe';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -137,13 +137,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Octahedron
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/octahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.OctahedronGeometry( 1, 0 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.OctahedronGeometry( 1, 0 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Octahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -153,14 +153,14 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Plane
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/plane' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.PlaneGeometry( 1, 1, 1, 1 );
|
|
|
- var material = new THREE.MeshStandardMaterial();
|
|
|
- var mesh = new THREE.Mesh( geometry, material );
|
|
|
+ const geometry = new THREE.PlaneGeometry( 1, 1, 1, 1 );
|
|
|
+ const material = new THREE.MeshStandardMaterial();
|
|
|
+ const mesh = new THREE.Mesh( geometry, material );
|
|
|
mesh.name = 'Plane';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -170,13 +170,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Ring
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/ring' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.RingGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.RingGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Ring';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -186,13 +186,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Sphere
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/sphere' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.SphereGeometry( 1, 32, 16, 0, Math.PI * 2, 0, Math.PI );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.SphereGeometry( 1, 32, 16, 0, Math.PI * 2, 0, Math.PI );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Sphere';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -202,12 +202,12 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Sprite
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/sprite' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var sprite = new THREE.Sprite( new THREE.SpriteMaterial() );
|
|
|
+ const sprite = new THREE.Sprite( new THREE.SpriteMaterial() );
|
|
|
sprite.name = 'Sprite';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, sprite ) );
|
|
@@ -217,13 +217,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Tetrahedron
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/tetrahedron' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.TetrahedronGeometry( 1, 0 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.TetrahedronGeometry( 1, 0 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Tetrahedron';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -233,13 +233,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Torus
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/torus' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.TorusGeometry( 1, 0.4, 8, 6, Math.PI * 2 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.TorusGeometry( 1, 0.4, 8, 6, Math.PI * 2 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Torus';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -249,13 +249,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// TorusKnot
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/torusknot' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var geometry = new THREE.TorusKnotGeometry( 1, 0.4, 64, 8, 2, 3 );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.TorusKnotGeometry( 1, 0.4, 64, 8, 2, 3 );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'TorusKnot';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -265,20 +265,20 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// Tube
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/tube' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var path = new THREE.CatmullRomCurve3( [
|
|
|
+ const path = new THREE.CatmullRomCurve3( [
|
|
|
new THREE.Vector3( 2, 2, - 2 ),
|
|
|
new THREE.Vector3( 2, - 2, - 0.6666666666666667 ),
|
|
|
new THREE.Vector3( - 2, - 2, 0.6666666666666667 ),
|
|
|
new THREE.Vector3( - 2, 2, 2 )
|
|
|
] );
|
|
|
|
|
|
- var geometry = new THREE.TubeGeometry( path, 64, 1, 8, false );
|
|
|
- var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
+ const geometry = new THREE.TubeGeometry( path, 64, 1, 8, false );
|
|
|
+ const mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
|
|
|
mesh.name = 'Tube';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, mesh ) );
|
|
@@ -289,23 +289,23 @@ function MenubarAdd( editor ) {
|
|
|
/*
|
|
|
// Teapot
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( 'Teapot' );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var size = 50;
|
|
|
- var segments = 10;
|
|
|
- var bottom = true;
|
|
|
- var lid = true;
|
|
|
- var body = true;
|
|
|
- var fitLid = false;
|
|
|
- var blinnScale = true;
|
|
|
+ let size = 50;
|
|
|
+ let segments = 10;
|
|
|
+ let bottom = true;
|
|
|
+ let lid = true;
|
|
|
+ let body = true;
|
|
|
+ let fitLid = false;
|
|
|
+ let blinnScale = true;
|
|
|
|
|
|
- var material = new THREE.MeshStandardMaterial();
|
|
|
+ let material = new THREE.MeshStandardMaterial();
|
|
|
|
|
|
- var geometry = new TeapotGeometry( size, segments, bottom, lid, body, fitLid, blinnScale );
|
|
|
- var mesh = new THREE.Mesh( geometry, material );
|
|
|
+ let geometry = new TeapotGeometry( size, segments, bottom, lid, body, fitLid, blinnScale );
|
|
|
+ let mesh = new THREE.Mesh( geometry, material );
|
|
|
mesh.name = 'Teapot';
|
|
|
|
|
|
editor.addObject( mesh );
|
|
@@ -321,14 +321,14 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// AmbientLight
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/ambientlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0x222222;
|
|
|
+ const color = 0x222222;
|
|
|
|
|
|
- var light = new THREE.AmbientLight( color );
|
|
|
+ const light = new THREE.AmbientLight( color );
|
|
|
light.name = 'AmbientLight';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, light ) );
|
|
@@ -338,15 +338,15 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// DirectionalLight
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/directionallight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0xffffff;
|
|
|
- var intensity = 1;
|
|
|
+ const color = 0xffffff;
|
|
|
+ const intensity = 1;
|
|
|
|
|
|
- var light = new THREE.DirectionalLight( color, intensity );
|
|
|
+ const light = new THREE.DirectionalLight( color, intensity );
|
|
|
light.name = 'DirectionalLight';
|
|
|
light.target.name = 'DirectionalLight Target';
|
|
|
|
|
@@ -359,16 +359,16 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// HemisphereLight
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/hemispherelight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var skyColor = 0x00aaff;
|
|
|
- var groundColor = 0xffaa00;
|
|
|
- var intensity = 1;
|
|
|
+ const skyColor = 0x00aaff;
|
|
|
+ const groundColor = 0xffaa00;
|
|
|
+ const intensity = 1;
|
|
|
|
|
|
- var light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
|
|
|
+ const light = new THREE.HemisphereLight( skyColor, groundColor, intensity );
|
|
|
light.name = 'HemisphereLight';
|
|
|
|
|
|
light.position.set( 0, 10, 0 );
|
|
@@ -380,16 +380,16 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// PointLight
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/pointlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0xffffff;
|
|
|
- var intensity = 1;
|
|
|
- var distance = 0;
|
|
|
+ const color = 0xffffff;
|
|
|
+ const intensity = 1;
|
|
|
+ const distance = 0;
|
|
|
|
|
|
- var light = new THREE.PointLight( color, intensity, distance );
|
|
|
+ const light = new THREE.PointLight( color, intensity, distance );
|
|
|
light.name = 'PointLight';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, light ) );
|
|
@@ -399,18 +399,18 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// SpotLight
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/spotlight' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var color = 0xffffff;
|
|
|
- var intensity = 1;
|
|
|
- var distance = 0;
|
|
|
- var angle = Math.PI * 0.1;
|
|
|
- var penumbra = 0;
|
|
|
+ const color = 0xffffff;
|
|
|
+ const intensity = 1;
|
|
|
+ const distance = 0;
|
|
|
+ const angle = Math.PI * 0.1;
|
|
|
+ const penumbra = 0;
|
|
|
|
|
|
- var light = new THREE.SpotLight( color, intensity, distance, angle, penumbra );
|
|
|
+ const light = new THREE.SpotLight( color, intensity, distance, angle, penumbra );
|
|
|
light.name = 'SpotLight';
|
|
|
light.target.name = 'SpotLight Target';
|
|
|
|
|
@@ -427,13 +427,13 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// OrthographicCamera
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/orthographiccamera' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var aspect = editor.camera.aspect;
|
|
|
- var camera = new THREE.OrthographicCamera( - aspect, aspect );
|
|
|
+ const aspect = editor.camera.aspect;
|
|
|
+ const camera = new THREE.OrthographicCamera( - aspect, aspect );
|
|
|
camera.name = 'OrthographicCamera';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, camera ) );
|
|
@@ -443,12 +443,12 @@ function MenubarAdd( editor ) {
|
|
|
|
|
|
// PerspectiveCamera
|
|
|
|
|
|
- var option = new UIRow();
|
|
|
+ option = new UIRow();
|
|
|
option.setClass( 'option' );
|
|
|
option.setTextContent( strings.getKey( 'menubar/add/perspectivecamera' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var camera = new THREE.PerspectiveCamera();
|
|
|
+ const camera = new THREE.PerspectiveCamera();
|
|
|
camera.name = 'PerspectiveCamera';
|
|
|
|
|
|
editor.execute( new AddObjectCommand( editor, camera ) );
|