@thanhthbm/scene-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/dist/index.css +921 -0
- package/dist/index.js +14076 -0
- package/package.json +49 -0
- package/src/editor/css/main.css +1030 -0
- package/src/editor/js/Animation.js +618 -0
- package/src/editor/js/AnimationResizer.js +73 -0
- package/src/editor/js/Command.js +40 -0
- package/src/editor/js/Config.js +86 -0
- package/src/editor/js/Editor.js +1006 -0
- package/src/editor/js/EditorControls.js +489 -0
- package/src/editor/js/GLTFImportDialog.js +112 -0
- package/src/editor/js/History.js +321 -0
- package/src/editor/js/Loader.js +1162 -0
- package/src/editor/js/LoaderUtils.js +90 -0
- package/src/editor/js/Menubar.Add.js +559 -0
- package/src/editor/js/Menubar.Edit.js +155 -0
- package/src/editor/js/Menubar.File.js +585 -0
- package/src/editor/js/Menubar.Help.js +73 -0
- package/src/editor/js/Menubar.Render.js +858 -0
- package/src/editor/js/Menubar.Status.js +51 -0
- package/src/editor/js/Menubar.View.js +193 -0
- package/src/editor/js/Menubar.js +29 -0
- package/src/editor/js/Player.js +53 -0
- package/src/editor/js/Resizer.js +65 -0
- package/src/editor/js/Script.js +532 -0
- package/src/editor/js/Selector.js +129 -0
- package/src/editor/js/Sidebar.Geometry.BoxGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.BufferGeometry.js +124 -0
- package/src/editor/js/Sidebar.Geometry.CapsuleGeometry.js +109 -0
- package/src/editor/js/Sidebar.Geometry.CircleGeometry.js +97 -0
- package/src/editor/js/Sidebar.Geometry.CylinderGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.DodecahedronGeometry.js +73 -0
- package/src/editor/js/Sidebar.Geometry.ExtrudeGeometry.js +196 -0
- package/src/editor/js/Sidebar.Geometry.IcosahedronGeometry.js +73 -0
- package/src/editor/js/Sidebar.Geometry.LatheGeometry.js +98 -0
- package/src/editor/js/Sidebar.Geometry.Modifiers.js +73 -0
- package/src/editor/js/Sidebar.Geometry.OctahedronGeometry.js +74 -0
- package/src/editor/js/Sidebar.Geometry.PlaneGeometry.js +97 -0
- package/src/editor/js/Sidebar.Geometry.RingGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.ShapeGeometry.js +76 -0
- package/src/editor/js/Sidebar.Geometry.SphereGeometry.js +133 -0
- package/src/editor/js/Sidebar.Geometry.TetrahedronGeometry.js +74 -0
- package/src/editor/js/Sidebar.Geometry.TextGeometry.js +136 -0
- package/src/editor/js/Sidebar.Geometry.TorusGeometry.js +109 -0
- package/src/editor/js/Sidebar.Geometry.TorusKnotGeometry.js +121 -0
- package/src/editor/js/Sidebar.Geometry.TubeGeometry.js +135 -0
- package/src/editor/js/Sidebar.Geometry.js +471 -0
- package/src/editor/js/Sidebar.Material.BooleanProperty.js +60 -0
- package/src/editor/js/Sidebar.Material.ColorProperty.js +87 -0
- package/src/editor/js/Sidebar.Material.ConstantProperty.js +62 -0
- package/src/editor/js/Sidebar.Material.MapProperty.js +277 -0
- package/src/editor/js/Sidebar.Material.NumberProperty.js +60 -0
- package/src/editor/js/Sidebar.Material.Program.js +73 -0
- package/src/editor/js/Sidebar.Material.RangeValueProperty.js +63 -0
- package/src/editor/js/Sidebar.Material.js +751 -0
- package/src/editor/js/Sidebar.Object.js +892 -0
- package/src/editor/js/Sidebar.Project.App.js +218 -0
- package/src/editor/js/Sidebar.Project.Materials.js +82 -0
- package/src/editor/js/Sidebar.Project.Renderer.js +193 -0
- package/src/editor/js/Sidebar.Project.Resources.js +242 -0
- package/src/editor/js/Sidebar.Project.js +21 -0
- package/src/editor/js/Sidebar.Properties.js +73 -0
- package/src/editor/js/Sidebar.Scene.js +643 -0
- package/src/editor/js/Sidebar.Script.js +129 -0
- package/src/editor/js/Sidebar.Settings.History.js +146 -0
- package/src/editor/js/Sidebar.Settings.Shortcuts.js +198 -0
- package/src/editor/js/Sidebar.Settings.js +58 -0
- package/src/editor/js/Sidebar.js +41 -0
- package/src/editor/js/Storage.js +98 -0
- package/src/editor/js/Strings.js +2718 -0
- package/src/editor/js/TextureParametersDialog.js +293 -0
- package/src/editor/js/Toolbar.js +75 -0
- package/src/editor/js/Viewport.Controls.js +98 -0
- package/src/editor/js/Viewport.Info.js +144 -0
- package/src/editor/js/Viewport.Pathtracer.js +27 -0
- package/src/editor/js/Viewport.ViewHelper.js +41 -0
- package/src/editor/js/Viewport.XR.js +7 -0
- package/src/editor/js/Viewport.js +982 -0
- package/src/editor/js/commands/AddObjectCommand.js +68 -0
- package/src/editor/js/commands/AddScriptCommand.js +75 -0
- package/src/editor/js/commands/Commands.js +24 -0
- package/src/editor/js/commands/MoveObjectCommand.js +117 -0
- package/src/editor/js/commands/MultiCmdsCommand.js +85 -0
- package/src/editor/js/commands/RemoveObjectCommand.js +88 -0
- package/src/editor/js/commands/RemoveScriptCommand.js +81 -0
- package/src/editor/js/commands/SetColorCommand.js +73 -0
- package/src/editor/js/commands/SetGeometryCommand.js +86 -0
- package/src/editor/js/commands/SetGeometryValueCommand.js +70 -0
- package/src/editor/js/commands/SetMaterialColorCommand.js +87 -0
- package/src/editor/js/commands/SetMaterialCommand.js +80 -0
- package/src/editor/js/commands/SetMaterialMapCommand.js +144 -0
- package/src/editor/js/commands/SetMaterialRangeCommand.js +92 -0
- package/src/editor/js/commands/SetMaterialValueCommand.js +91 -0
- package/src/editor/js/commands/SetMaterialVectorCommand.js +88 -0
- package/src/editor/js/commands/SetPositionCommand.js +84 -0
- package/src/editor/js/commands/SetRotationCommand.js +84 -0
- package/src/editor/js/commands/SetScaleCommand.js +84 -0
- package/src/editor/js/commands/SetSceneCommand.js +104 -0
- package/src/editor/js/commands/SetScriptValueCommand.js +80 -0
- package/src/editor/js/commands/SetShadowValueCommand.js +73 -0
- package/src/editor/js/commands/SetTextureParametersCommand.js +143 -0
- package/src/editor/js/commands/SetUuidCommand.js +70 -0
- package/src/editor/js/commands/SetValueCommand.js +75 -0
- package/src/editor/js/libs/acorn/acorn.js +3236 -0
- package/src/editor/js/libs/acorn/acorn_loose.js +1299 -0
- package/src/editor/js/libs/acorn/walk.js +344 -0
- package/src/editor/js/libs/app/index.html +51 -0
- package/src/editor/js/libs/app.js +14 -0
- package/src/editor/js/libs/codemirror/addon/dialog.css +32 -0
- package/src/editor/js/libs/codemirror/addon/dialog.js +163 -0
- package/src/editor/js/libs/codemirror/addon/show-hint.css +36 -0
- package/src/editor/js/libs/codemirror/addon/show-hint.js +529 -0
- package/src/editor/js/libs/codemirror/addon/tern.css +87 -0
- package/src/editor/js/libs/codemirror/addon/tern.js +750 -0
- package/src/editor/js/libs/codemirror/codemirror.css +344 -0
- package/src/editor/js/libs/codemirror/codemirror.js +9849 -0
- package/src/editor/js/libs/codemirror/mode/glsl.js +233 -0
- package/src/editor/js/libs/codemirror/mode/javascript.js +959 -0
- package/src/editor/js/libs/codemirror/theme/monokai.css +41 -0
- package/src/editor/js/libs/esprima.js +6401 -0
- package/src/editor/js/libs/jsonlint.js +453 -0
- package/src/editor/js/libs/signals.min.js +14 -0
- package/src/editor/js/libs/tern-threejs/build-defs.js +233 -0
- package/src/editor/js/libs/ternjs/comment.js +87 -0
- package/src/editor/js/libs/ternjs/def.js +588 -0
- package/src/editor/js/libs/ternjs/doc_comment.js +401 -0
- package/src/editor/js/libs/ternjs/infer.js +1635 -0
- package/src/editor/js/libs/ternjs/polyfill.js +80 -0
- package/src/editor/js/libs/ternjs/signal.js +26 -0
- package/src/editor/js/libs/ternjs/tern.js +993 -0
- package/src/editor/js/libs/ui.js +1305 -0
- package/src/editor/js/libs/ui.three.js +946 -0
- package/src/events.js +273 -0
- package/src/index.js +284 -0
- package/src/presets/machines.js +239 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
const signals = editor.signals;
|
|
11
|
+
|
|
12
|
+
const container = new UIDiv();
|
|
13
|
+
|
|
14
|
+
const geometry = object.geometry;
|
|
15
|
+
const parameters = geometry.parameters;
|
|
16
|
+
|
|
17
|
+
// innerRadius
|
|
18
|
+
|
|
19
|
+
const innerRadiusRow = new UIRow();
|
|
20
|
+
const innerRadius = new UINumber( parameters.innerRadius ).onChange( update );
|
|
21
|
+
|
|
22
|
+
innerRadiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/innerRadius' ) ).setClass( 'Label' ) );
|
|
23
|
+
innerRadiusRow.add( innerRadius );
|
|
24
|
+
|
|
25
|
+
container.add( innerRadiusRow );
|
|
26
|
+
|
|
27
|
+
// outerRadius
|
|
28
|
+
|
|
29
|
+
const outerRadiusRow = new UIRow();
|
|
30
|
+
const outerRadius = new UINumber( parameters.outerRadius ).onChange( update );
|
|
31
|
+
|
|
32
|
+
outerRadiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/outerRadius' ) ).setClass( 'Label' ) );
|
|
33
|
+
outerRadiusRow.add( outerRadius );
|
|
34
|
+
|
|
35
|
+
container.add( outerRadiusRow );
|
|
36
|
+
|
|
37
|
+
// thetaSegments
|
|
38
|
+
|
|
39
|
+
const thetaSegmentsRow = new UIRow();
|
|
40
|
+
const thetaSegments = new UIInteger( parameters.thetaSegments ).setRange( 3, Infinity ).onChange( update );
|
|
41
|
+
|
|
42
|
+
thetaSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/thetaSegments' ) ).setClass( 'Label' ) );
|
|
43
|
+
thetaSegmentsRow.add( thetaSegments );
|
|
44
|
+
|
|
45
|
+
container.add( thetaSegmentsRow );
|
|
46
|
+
|
|
47
|
+
// phiSegments
|
|
48
|
+
|
|
49
|
+
const phiSegmentsRow = new UIRow();
|
|
50
|
+
const phiSegments = new UIInteger( parameters.phiSegments ).setRange( 3, Infinity ).onChange( update );
|
|
51
|
+
|
|
52
|
+
phiSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/phiSegments' ) ).setClass( 'Label' ) );
|
|
53
|
+
phiSegmentsRow.add( phiSegments );
|
|
54
|
+
|
|
55
|
+
container.add( phiSegmentsRow );
|
|
56
|
+
|
|
57
|
+
// thetaStart
|
|
58
|
+
|
|
59
|
+
const thetaStartRow = new UIRow();
|
|
60
|
+
const thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
61
|
+
|
|
62
|
+
thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/thetastart' ) ).setClass( 'Label' ) );
|
|
63
|
+
thetaStartRow.add( thetaStart );
|
|
64
|
+
|
|
65
|
+
container.add( thetaStartRow );
|
|
66
|
+
|
|
67
|
+
// thetaLength
|
|
68
|
+
|
|
69
|
+
const thetaLengthRow = new UIRow();
|
|
70
|
+
const thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
71
|
+
|
|
72
|
+
thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/thetalength' ) ).setClass( 'Label' ) );
|
|
73
|
+
thetaLengthRow.add( thetaLength );
|
|
74
|
+
|
|
75
|
+
container.add( thetaLengthRow );
|
|
76
|
+
|
|
77
|
+
//
|
|
78
|
+
|
|
79
|
+
function refreshUI() {
|
|
80
|
+
|
|
81
|
+
const parameters = object.geometry.parameters;
|
|
82
|
+
|
|
83
|
+
innerRadius.setValue( parameters.innerRadius );
|
|
84
|
+
outerRadius.setValue( parameters.outerRadius );
|
|
85
|
+
thetaSegments.setValue( parameters.thetaSegments );
|
|
86
|
+
phiSegments.setValue( parameters.phiSegments );
|
|
87
|
+
thetaStart.setValue( parameters.thetaStart * THREE.MathUtils.RAD2DEG );
|
|
88
|
+
thetaLength.setValue( parameters.thetaLength * THREE.MathUtils.RAD2DEG );
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
93
|
+
|
|
94
|
+
if ( mesh === object ) {
|
|
95
|
+
|
|
96
|
+
refreshUI();
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
} );
|
|
101
|
+
|
|
102
|
+
//
|
|
103
|
+
|
|
104
|
+
function update() {
|
|
105
|
+
|
|
106
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.RingGeometry(
|
|
107
|
+
innerRadius.getValue(),
|
|
108
|
+
outerRadius.getValue(),
|
|
109
|
+
thetaSegments.getValue(),
|
|
110
|
+
phiSegments.getValue(),
|
|
111
|
+
thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
112
|
+
thetaLength.getValue() * THREE.MathUtils.DEG2RAD
|
|
113
|
+
) ) );
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return container;
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UIButton } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
const signals = editor.signals;
|
|
11
|
+
|
|
12
|
+
const container = new UIDiv();
|
|
13
|
+
|
|
14
|
+
const geometry = object.geometry;
|
|
15
|
+
const parameters = geometry.parameters;
|
|
16
|
+
|
|
17
|
+
// curveSegments
|
|
18
|
+
|
|
19
|
+
const curveSegmentsRow = new UIRow();
|
|
20
|
+
const curveSegments = new UIInteger( parameters.curveSegments || 12 ).onChange( changeShape ).setRange( 1, Infinity );
|
|
21
|
+
|
|
22
|
+
curveSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/shape_geometry/curveSegments' ) ).setClass( 'Label' ) );
|
|
23
|
+
curveSegmentsRow.add( curveSegments );
|
|
24
|
+
|
|
25
|
+
container.add( curveSegmentsRow );
|
|
26
|
+
|
|
27
|
+
// to extrude
|
|
28
|
+
const button = new UIButton( strings.getKey( 'sidebar/geometry/shape_geometry/extrude' ) ).onClick( toExtrude ).setClass( 'Label' ).setMarginLeft( '120px' );
|
|
29
|
+
container.add( button );
|
|
30
|
+
|
|
31
|
+
//
|
|
32
|
+
|
|
33
|
+
function refreshUI() {
|
|
34
|
+
|
|
35
|
+
const parameters = object.geometry.parameters;
|
|
36
|
+
|
|
37
|
+
curveSegments.setValue( parameters.curveSegments );
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
42
|
+
|
|
43
|
+
if ( mesh === object ) {
|
|
44
|
+
|
|
45
|
+
refreshUI();
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
//
|
|
52
|
+
|
|
53
|
+
function changeShape() {
|
|
54
|
+
|
|
55
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeGeometry(
|
|
56
|
+
parameters.shapes,
|
|
57
|
+
curveSegments.getValue()
|
|
58
|
+
) ) );
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function toExtrude() {
|
|
63
|
+
|
|
64
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeGeometry(
|
|
65
|
+
parameters.shapes, {
|
|
66
|
+
curveSegments: curveSegments.getValue()
|
|
67
|
+
}
|
|
68
|
+
) ) );
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return container;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
const signals = editor.signals;
|
|
11
|
+
|
|
12
|
+
const container = new UIDiv();
|
|
13
|
+
|
|
14
|
+
const geometry = object.geometry;
|
|
15
|
+
const parameters = geometry.parameters;
|
|
16
|
+
|
|
17
|
+
// radius
|
|
18
|
+
|
|
19
|
+
const radiusRow = new UIRow();
|
|
20
|
+
const radius = new UINumber( parameters.radius ).onChange( update );
|
|
21
|
+
|
|
22
|
+
radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/radius' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusRow.add( radius );
|
|
24
|
+
|
|
25
|
+
container.add( radiusRow );
|
|
26
|
+
|
|
27
|
+
// widthSegments
|
|
28
|
+
|
|
29
|
+
const widthSegmentsRow = new UIRow();
|
|
30
|
+
const widthSegments = new UIInteger( parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
|
|
31
|
+
|
|
32
|
+
widthSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/widthsegments' ) ).setClass( 'Label' ) );
|
|
33
|
+
widthSegmentsRow.add( widthSegments );
|
|
34
|
+
|
|
35
|
+
container.add( widthSegmentsRow );
|
|
36
|
+
|
|
37
|
+
// heightSegments
|
|
38
|
+
|
|
39
|
+
const heightSegmentsRow = new UIRow();
|
|
40
|
+
const heightSegments = new UIInteger( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
|
|
41
|
+
|
|
42
|
+
heightSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/heightsegments' ) ).setClass( 'Label' ) );
|
|
43
|
+
heightSegmentsRow.add( heightSegments );
|
|
44
|
+
|
|
45
|
+
container.add( heightSegmentsRow );
|
|
46
|
+
|
|
47
|
+
// phiStart
|
|
48
|
+
|
|
49
|
+
const phiStartRow = new UIRow();
|
|
50
|
+
const phiStart = new UINumber( parameters.phiStart * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
51
|
+
|
|
52
|
+
phiStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/phistart' ) ).setClass( 'Label' ) );
|
|
53
|
+
phiStartRow.add( phiStart );
|
|
54
|
+
|
|
55
|
+
container.add( phiStartRow );
|
|
56
|
+
|
|
57
|
+
// phiLength
|
|
58
|
+
|
|
59
|
+
const phiLengthRow = new UIRow();
|
|
60
|
+
const phiLength = new UINumber( parameters.phiLength * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
61
|
+
|
|
62
|
+
phiLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/philength' ) ).setClass( 'Label' ) );
|
|
63
|
+
phiLengthRow.add( phiLength );
|
|
64
|
+
|
|
65
|
+
container.add( phiLengthRow );
|
|
66
|
+
|
|
67
|
+
// thetaStart
|
|
68
|
+
|
|
69
|
+
const thetaStartRow = new UIRow();
|
|
70
|
+
const thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
71
|
+
|
|
72
|
+
thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/thetastart' ) ).setClass( 'Label' ) );
|
|
73
|
+
thetaStartRow.add( thetaStart );
|
|
74
|
+
|
|
75
|
+
container.add( thetaStartRow );
|
|
76
|
+
|
|
77
|
+
// thetaLength
|
|
78
|
+
|
|
79
|
+
const thetaLengthRow = new UIRow();
|
|
80
|
+
const thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
81
|
+
|
|
82
|
+
thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/thetalength' ) ).setClass( 'Label' ) );
|
|
83
|
+
thetaLengthRow.add( thetaLength );
|
|
84
|
+
|
|
85
|
+
container.add( thetaLengthRow );
|
|
86
|
+
|
|
87
|
+
//
|
|
88
|
+
|
|
89
|
+
function refreshUI() {
|
|
90
|
+
|
|
91
|
+
const parameters = object.geometry.parameters;
|
|
92
|
+
|
|
93
|
+
radius.setValue( parameters.radius );
|
|
94
|
+
widthSegments.setValue( parameters.widthSegments );
|
|
95
|
+
heightSegments.setValue( parameters.heightSegments );
|
|
96
|
+
phiStart.setValue( parameters.phiStart * THREE.MathUtils.RAD2DEG );
|
|
97
|
+
phiLength.setValue( parameters.phiLength * THREE.MathUtils.RAD2DEG );
|
|
98
|
+
thetaStart.setValue( parameters.thetaStart * THREE.MathUtils.RAD2DEG );
|
|
99
|
+
thetaLength.setValue( parameters.thetaLength * THREE.MathUtils.RAD2DEG );
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
104
|
+
|
|
105
|
+
if ( mesh === object ) {
|
|
106
|
+
|
|
107
|
+
refreshUI();
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
//
|
|
114
|
+
|
|
115
|
+
function update() {
|
|
116
|
+
|
|
117
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.SphereGeometry(
|
|
118
|
+
radius.getValue(),
|
|
119
|
+
widthSegments.getValue(),
|
|
120
|
+
heightSegments.getValue(),
|
|
121
|
+
phiStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
122
|
+
phiLength.getValue() * THREE.MathUtils.DEG2RAD,
|
|
123
|
+
thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
124
|
+
thetaLength.getValue() * THREE.MathUtils.DEG2RAD
|
|
125
|
+
) ) );
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return container;
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
|
|
11
|
+
const signals = editor.signals;
|
|
12
|
+
|
|
13
|
+
const container = new UIDiv();
|
|
14
|
+
|
|
15
|
+
const geometry = object.geometry;
|
|
16
|
+
const parameters = geometry.parameters;
|
|
17
|
+
|
|
18
|
+
// radius
|
|
19
|
+
|
|
20
|
+
const radiusRow = new UIRow();
|
|
21
|
+
const radius = new UINumber( parameters.radius ).onChange( update );
|
|
22
|
+
|
|
23
|
+
radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/tetrahedron_geometry/radius' ) ).setClass( 'Label' ) );
|
|
24
|
+
radiusRow.add( radius );
|
|
25
|
+
|
|
26
|
+
container.add( radiusRow );
|
|
27
|
+
|
|
28
|
+
// detail
|
|
29
|
+
|
|
30
|
+
const detailRow = new UIRow();
|
|
31
|
+
const detail = new UIInteger( parameters.detail ).setRange( 0, Infinity ).onChange( update );
|
|
32
|
+
|
|
33
|
+
detailRow.add( new UIText( strings.getKey( 'sidebar/geometry/tetrahedron_geometry/detail' ) ).setClass( 'Label' ) );
|
|
34
|
+
detailRow.add( detail );
|
|
35
|
+
|
|
36
|
+
container.add( detailRow );
|
|
37
|
+
|
|
38
|
+
//
|
|
39
|
+
|
|
40
|
+
function refreshUI() {
|
|
41
|
+
|
|
42
|
+
const parameters = object.geometry.parameters;
|
|
43
|
+
|
|
44
|
+
radius.setValue( parameters.radius );
|
|
45
|
+
detail.setValue( parameters.detail );
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
50
|
+
|
|
51
|
+
if ( mesh === object ) {
|
|
52
|
+
|
|
53
|
+
refreshUI();
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} );
|
|
58
|
+
|
|
59
|
+
//
|
|
60
|
+
|
|
61
|
+
function update() {
|
|
62
|
+
|
|
63
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.TetrahedronGeometry(
|
|
64
|
+
radius.getValue(),
|
|
65
|
+
detail.getValue()
|
|
66
|
+
) ) );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return container;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { TextGeometry } from 'three/addons/geometries/TextGeometry.js';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UINumber, UIInteger, UIInput, UICheckbox } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
|
|
11
|
+
const container = new UIDiv();
|
|
12
|
+
|
|
13
|
+
const geometry = object.geometry;
|
|
14
|
+
const parameters = geometry.parameters.options;
|
|
15
|
+
|
|
16
|
+
// text
|
|
17
|
+
|
|
18
|
+
const textRow = new UIRow();
|
|
19
|
+
const text = new UIInput().setValue( parameters.text ).onChange( update );
|
|
20
|
+
|
|
21
|
+
textRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/text' ) ).setClass( 'Label' ) );
|
|
22
|
+
textRow.add( text );
|
|
23
|
+
|
|
24
|
+
container.add( textRow );
|
|
25
|
+
|
|
26
|
+
// size
|
|
27
|
+
|
|
28
|
+
const sizeRow = new UIRow();
|
|
29
|
+
const size = new UINumber().setPrecision( 3 ).setValue( parameters.size ).onChange( update );
|
|
30
|
+
|
|
31
|
+
sizeRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/size' ) ).setClass( 'Label' ) );
|
|
32
|
+
sizeRow.add( size );
|
|
33
|
+
|
|
34
|
+
container.add( sizeRow );
|
|
35
|
+
|
|
36
|
+
// depth
|
|
37
|
+
|
|
38
|
+
const depthRow = new UIRow();
|
|
39
|
+
const depth = new UINumber().setPrecision( 3 ).setValue( parameters.depth ).onChange( update );
|
|
40
|
+
|
|
41
|
+
depthRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/depth' ) ).setClass( 'Label' ) );
|
|
42
|
+
depthRow.add( depth );
|
|
43
|
+
|
|
44
|
+
container.add( depthRow );
|
|
45
|
+
|
|
46
|
+
// curveSegments
|
|
47
|
+
|
|
48
|
+
const curveSegmentsRow = new UIRow();
|
|
49
|
+
const curveSegments = new UIInteger( parameters.curveSegments ).setRange( 1, Infinity ).onChange( update );
|
|
50
|
+
|
|
51
|
+
curveSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/curveseg' ) ).setClass( 'Label' ) );
|
|
52
|
+
curveSegmentsRow.add( curveSegments );
|
|
53
|
+
|
|
54
|
+
container.add( curveSegmentsRow );
|
|
55
|
+
|
|
56
|
+
// bevelEnabled
|
|
57
|
+
|
|
58
|
+
const bevelEnabledRow = new UIRow();
|
|
59
|
+
const bevelEnabled = new UICheckbox( parameters.bevelEnabled ).onChange( update );
|
|
60
|
+
|
|
61
|
+
bevelEnabledRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/bevelenabled' ) ).setClass( 'Label' ) );
|
|
62
|
+
bevelEnabledRow.add( bevelEnabled );
|
|
63
|
+
|
|
64
|
+
container.add( bevelEnabledRow );
|
|
65
|
+
|
|
66
|
+
// bevelThickness
|
|
67
|
+
|
|
68
|
+
const bevelThicknessRow = new UIRow();
|
|
69
|
+
const bevelThickness = new UINumber( parameters.bevelThickness ).setPrecision( 3 ).setRange( 0, Infinity ).onChange( update );
|
|
70
|
+
|
|
71
|
+
bevelThicknessRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/bevelthickness' ) ).setClass( 'Label' ) );
|
|
72
|
+
bevelThicknessRow.add( bevelThickness );
|
|
73
|
+
|
|
74
|
+
container.add( bevelThicknessRow );
|
|
75
|
+
|
|
76
|
+
// bevelSize
|
|
77
|
+
|
|
78
|
+
const bevelSizeRow = new UIRow();
|
|
79
|
+
const bevelSize = new UINumber( parameters.bevelSize ).setRange( 0, Infinity ).onChange( update );
|
|
80
|
+
|
|
81
|
+
bevelSizeRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/bevelsize' ) ).setClass( 'Label' ) );
|
|
82
|
+
bevelSizeRow.add( bevelSize );
|
|
83
|
+
|
|
84
|
+
container.add( bevelSizeRow );
|
|
85
|
+
|
|
86
|
+
// bevelOffset
|
|
87
|
+
|
|
88
|
+
const bevelOffsetRow = new UIRow();
|
|
89
|
+
const bevelOffset = new UINumber( parameters.bevelOffset ).setRange( 0, Infinity ).onChange( update );
|
|
90
|
+
|
|
91
|
+
bevelOffsetRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/bevelOffset' ) ).setClass( 'Label' ) );
|
|
92
|
+
bevelOffsetRow.add( bevelOffset );
|
|
93
|
+
|
|
94
|
+
container.add( bevelOffsetRow );
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// bevelSegments
|
|
98
|
+
|
|
99
|
+
const bevelSegmentsRow = new UIRow();
|
|
100
|
+
const bevelSegments = new UIInteger( parameters.bevelSegments ).setRange( 0, Infinity ).onChange( update );
|
|
101
|
+
|
|
102
|
+
bevelSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/text_geometry/bevelseg' ) ).setClass( 'Label' ) );
|
|
103
|
+
bevelSegmentsRow.add( bevelSegments );
|
|
104
|
+
|
|
105
|
+
container.add( bevelSegmentsRow );
|
|
106
|
+
|
|
107
|
+
function update() {
|
|
108
|
+
|
|
109
|
+
const options = {
|
|
110
|
+
|
|
111
|
+
text: text.getValue(),
|
|
112
|
+
font: parameters.font,
|
|
113
|
+
|
|
114
|
+
size: size.getValue(),
|
|
115
|
+
depth: depth.getValue(),
|
|
116
|
+
curveSegments: curveSegments.getValue(),
|
|
117
|
+
|
|
118
|
+
bevelEnabled: bevelEnabled.getValue(),
|
|
119
|
+
bevelThickness: bevelThickness.getValue(),
|
|
120
|
+
bevelSize: bevelSize.getValue(),
|
|
121
|
+
bevelOffset: bevelOffset.getValue(),
|
|
122
|
+
bevelSegments: bevelSegments.getValue()
|
|
123
|
+
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const geometry = new TextGeometry( options.text, options );
|
|
127
|
+
|
|
128
|
+
editor.execute( new SetGeometryCommand( editor, object, geometry ) );
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return container;
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
6
|
+
|
|
7
|
+
function GeometryParametersPanel( editor, object ) {
|
|
8
|
+
|
|
9
|
+
const strings = editor.strings;
|
|
10
|
+
const signals = editor.signals;
|
|
11
|
+
|
|
12
|
+
const container = new UIDiv();
|
|
13
|
+
|
|
14
|
+
const geometry = object.geometry;
|
|
15
|
+
const parameters = geometry.parameters;
|
|
16
|
+
|
|
17
|
+
// radius
|
|
18
|
+
|
|
19
|
+
const radiusRow = new UIRow();
|
|
20
|
+
const radius = new UINumber( parameters.radius ).onChange( update );
|
|
21
|
+
|
|
22
|
+
radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/radius' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusRow.add( radius );
|
|
24
|
+
|
|
25
|
+
container.add( radiusRow );
|
|
26
|
+
|
|
27
|
+
// tube
|
|
28
|
+
|
|
29
|
+
const tubeRow = new UIRow();
|
|
30
|
+
const tube = new UINumber( parameters.tube ).onChange( update );
|
|
31
|
+
|
|
32
|
+
tubeRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/tube' ) ).setClass( 'Label' ) );
|
|
33
|
+
tubeRow.add( tube );
|
|
34
|
+
|
|
35
|
+
container.add( tubeRow );
|
|
36
|
+
|
|
37
|
+
// radialSegments
|
|
38
|
+
|
|
39
|
+
const radialSegmentsRow = new UIRow();
|
|
40
|
+
const radialSegments = new UIInteger( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
|
|
41
|
+
|
|
42
|
+
radialSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/radialsegments' ) ).setClass( 'Label' ) );
|
|
43
|
+
radialSegmentsRow.add( radialSegments );
|
|
44
|
+
|
|
45
|
+
container.add( radialSegmentsRow );
|
|
46
|
+
|
|
47
|
+
// tubularSegments
|
|
48
|
+
|
|
49
|
+
const tubularSegmentsRow = new UIRow();
|
|
50
|
+
const tubularSegments = new UIInteger( parameters.tubularSegments ).setRange( 1, Infinity ).onChange( update );
|
|
51
|
+
|
|
52
|
+
tubularSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/tubularsegments' ) ).setClass( 'Label' ) );
|
|
53
|
+
tubularSegmentsRow.add( tubularSegments );
|
|
54
|
+
|
|
55
|
+
container.add( tubularSegmentsRow );
|
|
56
|
+
|
|
57
|
+
// arc
|
|
58
|
+
|
|
59
|
+
const arcRow = new UIRow();
|
|
60
|
+
const arc = new UINumber( parameters.arc * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
61
|
+
|
|
62
|
+
arcRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/arc' ) ).setClass( 'Label' ) );
|
|
63
|
+
arcRow.add( arc );
|
|
64
|
+
|
|
65
|
+
container.add( arcRow );
|
|
66
|
+
|
|
67
|
+
//
|
|
68
|
+
|
|
69
|
+
function refreshUI() {
|
|
70
|
+
|
|
71
|
+
const parameters = object.geometry.parameters;
|
|
72
|
+
|
|
73
|
+
radius.setValue( parameters.radius );
|
|
74
|
+
tube.setValue( parameters.tube );
|
|
75
|
+
radialSegments.setValue( parameters.radialSegments );
|
|
76
|
+
tubularSegments.setValue( parameters.tubularSegments );
|
|
77
|
+
arc.setValue( parameters.arc * THREE.MathUtils.RAD2DEG );
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
82
|
+
|
|
83
|
+
if ( mesh === object ) {
|
|
84
|
+
|
|
85
|
+
refreshUI();
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} );
|
|
90
|
+
|
|
91
|
+
//
|
|
92
|
+
|
|
93
|
+
function update() {
|
|
94
|
+
|
|
95
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.TorusGeometry(
|
|
96
|
+
radius.getValue(),
|
|
97
|
+
tube.getValue(),
|
|
98
|
+
radialSegments.getValue(),
|
|
99
|
+
tubularSegments.getValue(),
|
|
100
|
+
arc.getValue() * THREE.MathUtils.DEG2RAD
|
|
101
|
+
) ) );
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return container;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { GeometryParametersPanel };
|