spoint 0.1.0 → 0.1.11
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 +134 -209
- package/SKILL.md +95 -0
- package/apps/environment/index.js +200 -1
- package/apps/environment/models/decorative/.gitkeep +0 -0
- package/apps/environment/models/hazards/.gitkeep +0 -0
- package/apps/environment/models/interactive/.gitkeep +0 -0
- package/apps/environment/models/structures/.gitkeep +0 -0
- package/apps/environment/smartObjects.js +114 -0
- package/apps/interactable/index.js +155 -0
- package/apps/physics-crate/index.js +15 -9
- package/apps/power-crate/index.js +18 -12
- package/apps/tps-game/$GDUPI.vrm +0 -0
- package/apps/tps-game/Cleetus.vrm +0 -0
- package/apps/tps-game/index.js +185 -27
- package/apps/world/index.js +68 -22
- package/bin/create-app.js +337 -0
- package/client/ARControls.js +301 -0
- package/client/LoadingManager.js +117 -0
- package/client/MobileControls.js +1122 -0
- package/client/anim-lib.glb +0 -0
- package/client/animation.js +306 -0
- package/client/app.js +1341 -65
- package/client/camera.js +191 -33
- package/client/createLoadingScreen.js +69 -0
- package/client/editor/bridge.js +113 -0
- package/client/editor/css/main.css +794 -0
- package/client/editor/images/rotate.svg +4 -0
- package/client/editor/images/scale.svg +4 -0
- package/client/editor/images/translate.svg +4 -0
- package/client/editor/index.html +103 -0
- package/client/editor/js/Command.js +41 -0
- package/client/editor/js/Config.js +81 -0
- package/client/editor/js/Editor.js +785 -0
- package/client/editor/js/EditorControls.js +438 -0
- package/client/editor/js/History.js +321 -0
- package/client/editor/js/Loader.js +987 -0
- package/client/editor/js/LoaderUtils.js +90 -0
- package/client/editor/js/Menubar.Add.js +510 -0
- package/client/editor/js/Menubar.Edit.js +145 -0
- package/client/editor/js/Menubar.File.js +466 -0
- package/client/editor/js/Menubar.Help.js +73 -0
- package/client/editor/js/Menubar.Status.js +51 -0
- package/client/editor/js/Menubar.View.js +183 -0
- package/client/editor/js/Menubar.js +27 -0
- package/client/editor/js/Player.js +53 -0
- package/client/editor/js/Resizer.js +58 -0
- package/client/editor/js/Script.js +503 -0
- package/client/editor/js/Selector.js +102 -0
- package/client/editor/js/Sidebar.Geometry.BoxGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.BufferGeometry.js +115 -0
- package/client/editor/js/Sidebar.Geometry.CapsuleGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.CircleGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.CylinderGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.DodecahedronGeometry.js +73 -0
- package/client/editor/js/Sidebar.Geometry.ExtrudeGeometry.js +196 -0
- package/client/editor/js/Sidebar.Geometry.IcosahedronGeometry.js +73 -0
- package/client/editor/js/Sidebar.Geometry.LatheGeometry.js +98 -0
- package/client/editor/js/Sidebar.Geometry.Modifiers.js +73 -0
- package/client/editor/js/Sidebar.Geometry.OctahedronGeometry.js +74 -0
- package/client/editor/js/Sidebar.Geometry.PlaneGeometry.js +97 -0
- package/client/editor/js/Sidebar.Geometry.RingGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.ShapeGeometry.js +76 -0
- package/client/editor/js/Sidebar.Geometry.SphereGeometry.js +133 -0
- package/client/editor/js/Sidebar.Geometry.TetrahedronGeometry.js +74 -0
- package/client/editor/js/Sidebar.Geometry.TorusGeometry.js +109 -0
- package/client/editor/js/Sidebar.Geometry.TorusKnotGeometry.js +121 -0
- package/client/editor/js/Sidebar.Geometry.TubeGeometry.js +135 -0
- package/client/editor/js/Sidebar.Geometry.js +332 -0
- package/client/editor/js/Sidebar.Material.BooleanProperty.js +60 -0
- package/client/editor/js/Sidebar.Material.ColorProperty.js +87 -0
- package/client/editor/js/Sidebar.Material.ConstantProperty.js +62 -0
- package/client/editor/js/Sidebar.Material.MapProperty.js +249 -0
- package/client/editor/js/Sidebar.Material.NumberProperty.js +60 -0
- package/client/editor/js/Sidebar.Material.Program.js +73 -0
- package/client/editor/js/Sidebar.Material.RangeValueProperty.js +63 -0
- package/client/editor/js/Sidebar.Material.js +751 -0
- package/client/editor/js/Sidebar.Object.Animation.js +102 -0
- package/client/editor/js/Sidebar.Object.js +898 -0
- package/client/editor/js/Sidebar.Project.App.js +165 -0
- package/client/editor/js/Sidebar.Project.Image.js +225 -0
- package/client/editor/js/Sidebar.Project.Materials.js +82 -0
- package/client/editor/js/Sidebar.Project.Renderer.js +144 -0
- package/client/editor/js/Sidebar.Project.Video.js +242 -0
- package/client/editor/js/Sidebar.Project.js +31 -0
- package/client/editor/js/Sidebar.Properties.js +73 -0
- package/client/editor/js/Sidebar.Scene.js +585 -0
- package/client/editor/js/Sidebar.Script.js +129 -0
- package/client/editor/js/Sidebar.Settings.History.js +146 -0
- package/client/editor/js/Sidebar.Settings.Shortcuts.js +175 -0
- package/client/editor/js/Sidebar.Settings.js +60 -0
- package/client/editor/js/Sidebar.js +41 -0
- package/client/editor/js/Storage.js +98 -0
- package/client/editor/js/Strings.js +2028 -0
- package/client/editor/js/Toolbar.js +84 -0
- package/client/editor/js/Viewport.Controls.js +92 -0
- package/client/editor/js/Viewport.Info.js +136 -0
- package/client/editor/js/Viewport.Pathtracer.js +91 -0
- package/client/editor/js/Viewport.ViewHelper.js +39 -0
- package/client/editor/js/Viewport.XR.js +222 -0
- package/client/editor/js/Viewport.js +900 -0
- package/client/editor/js/commands/AddObjectCommand.js +68 -0
- package/client/editor/js/commands/AddScriptCommand.js +75 -0
- package/client/editor/js/commands/Commands.js +23 -0
- package/client/editor/js/commands/MoveObjectCommand.js +111 -0
- package/client/editor/js/commands/MultiCmdsCommand.js +85 -0
- package/client/editor/js/commands/RemoveObjectCommand.js +88 -0
- package/client/editor/js/commands/RemoveScriptCommand.js +81 -0
- package/client/editor/js/commands/SetColorCommand.js +73 -0
- package/client/editor/js/commands/SetGeometryCommand.js +87 -0
- package/client/editor/js/commands/SetGeometryValueCommand.js +70 -0
- package/client/editor/js/commands/SetMaterialColorCommand.js +86 -0
- package/client/editor/js/commands/SetMaterialCommand.js +79 -0
- package/client/editor/js/commands/SetMaterialMapCommand.js +143 -0
- package/client/editor/js/commands/SetMaterialRangeCommand.js +91 -0
- package/client/editor/js/commands/SetMaterialValueCommand.js +90 -0
- package/client/editor/js/commands/SetMaterialVectorCommand.js +79 -0
- package/client/editor/js/commands/SetPositionCommand.js +84 -0
- package/client/editor/js/commands/SetRotationCommand.js +84 -0
- package/client/editor/js/commands/SetScaleCommand.js +84 -0
- package/client/editor/js/commands/SetSceneCommand.js +103 -0
- package/client/editor/js/commands/SetScriptValueCommand.js +80 -0
- package/client/editor/js/commands/SetShadowValueCommand.js +73 -0
- package/client/editor/js/commands/SetUuidCommand.js +70 -0
- package/client/editor/js/commands/SetValueCommand.js +75 -0
- package/client/editor/js/libs/acorn/acorn.js +3236 -0
- package/client/editor/js/libs/acorn/acorn_loose.js +1299 -0
- package/client/editor/js/libs/acorn/walk.js +344 -0
- package/client/editor/js/libs/app/index.html +57 -0
- package/client/editor/js/libs/app.js +251 -0
- package/client/editor/js/libs/codemirror/addon/dialog.css +32 -0
- package/client/editor/js/libs/codemirror/addon/dialog.js +163 -0
- package/client/editor/js/libs/codemirror/addon/show-hint.css +36 -0
- package/client/editor/js/libs/codemirror/addon/show-hint.js +529 -0
- package/client/editor/js/libs/codemirror/addon/tern.css +87 -0
- package/client/editor/js/libs/codemirror/addon/tern.js +750 -0
- package/client/editor/js/libs/codemirror/codemirror.css +344 -0
- package/client/editor/js/libs/codemirror/codemirror.js +9849 -0
- package/client/editor/js/libs/codemirror/mode/glsl.js +233 -0
- package/client/editor/js/libs/codemirror/mode/javascript.js +959 -0
- package/client/editor/js/libs/codemirror/theme/monokai.css +41 -0
- package/client/editor/js/libs/esprima.js +6401 -0
- package/client/editor/js/libs/jsonlint.js +453 -0
- package/client/editor/js/libs/signals.min.js +14 -0
- package/client/editor/js/libs/tern-threejs/threejs.js +5031 -0
- package/client/editor/js/libs/ternjs/comment.js +87 -0
- package/client/editor/js/libs/ternjs/def.js +588 -0
- package/client/editor/js/libs/ternjs/doc_comment.js +401 -0
- package/client/editor/js/libs/ternjs/infer.js +1635 -0
- package/client/editor/js/libs/ternjs/polyfill.js +80 -0
- package/client/editor/js/libs/ternjs/signal.js +26 -0
- package/client/editor/js/libs/ternjs/tern.js +993 -0
- package/client/editor/js/libs/ui.js +1346 -0
- package/client/editor/js/libs/ui.three.js +855 -0
- package/client/facial-animation.js +455 -0
- package/client/index.html +7 -4
- package/client/loading.css +147 -0
- package/client/loading.html +25 -0
- package/client/style.css +251 -0
- package/package.json +7 -3
- package/server.js +9 -1
- package/src/apps/AppContext.js +1 -1
- package/src/apps/AppLoader.js +50 -37
- package/src/apps/AppRuntime.js +32 -8
- package/src/client/InputHandler.js +233 -0
- package/src/client/JitterBuffer.js +207 -0
- package/src/client/KalmanFilter.js +125 -0
- package/src/client/MessageHandler.js +101 -0
- package/src/client/PhysicsNetworkClient.js +141 -68
- package/src/client/ReconnectManager.js +62 -0
- package/src/client/SmoothInterpolation.js +127 -0
- package/src/client/SnapshotProcessor.js +144 -0
- package/src/connection/ConnectionManager.js +21 -3
- package/src/connection/SessionStore.js +13 -3
- package/src/index.client.js +4 -6
- package/src/netcode/EventLog.js +29 -15
- package/src/netcode/LagCompensator.js +25 -26
- package/src/netcode/NetworkState.js +4 -1
- package/src/netcode/PhysicsIntegration.js +20 -6
- package/src/netcode/PlayerManager.js +10 -2
- package/src/netcode/SnapshotEncoder.js +66 -19
- package/src/netcode/TickSystem.js +13 -4
- package/src/physics/World.js +66 -13
- package/src/protocol/msgpack.js +90 -63
- package/src/sdk/ReloadHandlers.js +12 -2
- package/src/sdk/ReloadManager.js +5 -0
- package/src/sdk/ServerHandlers.js +50 -11
- package/src/sdk/StaticHandler.js +22 -6
- package/src/sdk/TickHandler.js +101 -34
- package/src/sdk/scaffold.js +31 -0
- package/src/sdk/server.js +59 -33
- package/src/shared/movement.js +2 -1
- package/src/spatial/Octree.js +5 -0
- package/apps/interactive-door/index.js +0 -33
- package/apps/patrol-npc/index.js +0 -37
- package/src/connection/QualityMonitor.js +0 -46
- package/src/debug/StateInspector.js +0 -42
- package/src/index.js +0 -1
- package/src/index.server.js +0 -27
- package/src/protocol/Codec.js +0 -60
- package/src/protocol/SequenceTracker.js +0 -71
- package/src/sdk/ClientMessageHandler.js +0 -80
- package/src/sdk/client.js +0 -122
- package/world/kaira.glb +0 -0
- package/world/schwust.glb +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { UIRow, UIText, UISpan, UIBreak, UICheckbox } from './libs/ui.js';
|
|
2
|
+
|
|
3
|
+
function SidebarGeometryBufferGeometry( editor ) {
|
|
4
|
+
|
|
5
|
+
const strings = editor.strings;
|
|
6
|
+
|
|
7
|
+
const signals = editor.signals;
|
|
8
|
+
|
|
9
|
+
const container = new UIRow();
|
|
10
|
+
|
|
11
|
+
function update( object ) {
|
|
12
|
+
|
|
13
|
+
if ( object === null ) return; // objectSelected.dispatch( null )
|
|
14
|
+
if ( object === undefined ) return;
|
|
15
|
+
|
|
16
|
+
const geometry = object.geometry;
|
|
17
|
+
|
|
18
|
+
if ( geometry ) {
|
|
19
|
+
|
|
20
|
+
container.clear();
|
|
21
|
+
container.setDisplay( 'block' );
|
|
22
|
+
|
|
23
|
+
// attributes
|
|
24
|
+
|
|
25
|
+
const attributesRow = new UIRow();
|
|
26
|
+
|
|
27
|
+
const textAttributes = new UIText( strings.getKey( 'sidebar/geometry/buffer_geometry/attributes' ) ).setClass( 'Label' );
|
|
28
|
+
attributesRow.add( textAttributes );
|
|
29
|
+
|
|
30
|
+
const containerAttributes = new UISpan().setDisplay( 'inline-block' ).setVerticalAlign( 'middle' ).setWidth( '160px' );
|
|
31
|
+
attributesRow.add( containerAttributes );
|
|
32
|
+
|
|
33
|
+
const index = geometry.index;
|
|
34
|
+
|
|
35
|
+
if ( index !== null ) {
|
|
36
|
+
|
|
37
|
+
containerAttributes.add( new UIText( strings.getKey( 'sidebar/geometry/buffer_geometry/index' ) ).setWidth( '80px' ) );
|
|
38
|
+
containerAttributes.add( new UIText( editor.utils.formatNumber( index.count ) ).setFontSize( '12px' ) );
|
|
39
|
+
containerAttributes.add( new UIBreak() );
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const attributes = geometry.attributes;
|
|
44
|
+
|
|
45
|
+
for ( const name in attributes ) {
|
|
46
|
+
|
|
47
|
+
const attribute = attributes[ name ];
|
|
48
|
+
|
|
49
|
+
containerAttributes.add( new UIText( name ).setWidth( '80px' ) );
|
|
50
|
+
containerAttributes.add( new UIText( editor.utils.formatNumber( attribute.count ) + ' (' + attribute.itemSize + ')' ).setFontSize( '12px' ) );
|
|
51
|
+
containerAttributes.add( new UIBreak() );
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
container.add( attributesRow );
|
|
56
|
+
|
|
57
|
+
// morph targets
|
|
58
|
+
|
|
59
|
+
const morphAttributes = geometry.morphAttributes;
|
|
60
|
+
const hasMorphTargets = Object.keys( morphAttributes ).length > 0;
|
|
61
|
+
|
|
62
|
+
if ( hasMorphTargets === true ) {
|
|
63
|
+
|
|
64
|
+
// morph attributes
|
|
65
|
+
|
|
66
|
+
const rowMorphAttributes = new UIRow();
|
|
67
|
+
|
|
68
|
+
const textMorphAttributes = new UIText( strings.getKey( 'sidebar/geometry/buffer_geometry/morphAttributes' ) ).setClass( 'Label' );
|
|
69
|
+
rowMorphAttributes.add( textMorphAttributes );
|
|
70
|
+
|
|
71
|
+
const containerMorphAttributes = new UISpan().setDisplay( 'inline-block' ).setVerticalAlign( 'middle' ).setWidth( '160px' );
|
|
72
|
+
rowMorphAttributes.add( containerMorphAttributes );
|
|
73
|
+
|
|
74
|
+
for ( const name in morphAttributes ) {
|
|
75
|
+
|
|
76
|
+
const morphTargets = morphAttributes[ name ];
|
|
77
|
+
|
|
78
|
+
containerMorphAttributes.add( new UIText( name ).setWidth( '80px' ) );
|
|
79
|
+
containerMorphAttributes.add( new UIText( editor.utils.formatNumber( morphTargets.length ) ).setFontSize( '12px' ) );
|
|
80
|
+
containerMorphAttributes.add( new UIBreak() );
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
container.add( rowMorphAttributes );
|
|
85
|
+
|
|
86
|
+
// morph relative
|
|
87
|
+
|
|
88
|
+
const rowMorphRelative = new UIRow();
|
|
89
|
+
|
|
90
|
+
const textMorphRelative = new UIText( strings.getKey( 'sidebar/geometry/buffer_geometry/morphRelative' ) ).setClass( 'Label' );
|
|
91
|
+
rowMorphRelative.add( textMorphRelative );
|
|
92
|
+
|
|
93
|
+
const checkboxMorphRelative = new UICheckbox().setValue( geometry.morphTargetsRelative ).setDisabled( true );
|
|
94
|
+
rowMorphRelative.add( checkboxMorphRelative );
|
|
95
|
+
|
|
96
|
+
container.add( rowMorphRelative );
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
} else {
|
|
101
|
+
|
|
102
|
+
container.setDisplay( 'none' );
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
signals.objectSelected.add( update );
|
|
109
|
+
signals.geometryChanged.add( update );
|
|
110
|
+
|
|
111
|
+
return container;
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { SidebarGeometryBufferGeometry };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UINumber, UIInteger } 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/capsule_geometry/radius' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusRow.add( radius );
|
|
24
|
+
|
|
25
|
+
container.add( radiusRow );
|
|
26
|
+
|
|
27
|
+
// length
|
|
28
|
+
|
|
29
|
+
const lengthRow = new UIRow();
|
|
30
|
+
const length = new UINumber( parameters.length ).onChange( update );
|
|
31
|
+
|
|
32
|
+
lengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/capsule_geometry/length' ) ).setClass( 'Label' ) );
|
|
33
|
+
lengthRow.add( length );
|
|
34
|
+
|
|
35
|
+
container.add( lengthRow );
|
|
36
|
+
|
|
37
|
+
// capSegments
|
|
38
|
+
|
|
39
|
+
const capSegmentsRow = new UIRow();
|
|
40
|
+
const capSegments = new UIInteger( parameters.capSegments ).setRange( 1, Infinity ).onChange( update );
|
|
41
|
+
|
|
42
|
+
capSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/capsule_geometry/capseg' ) ).setClass( 'Label' ) );
|
|
43
|
+
capSegmentsRow.add( capSegments );
|
|
44
|
+
|
|
45
|
+
container.add( capSegmentsRow );
|
|
46
|
+
|
|
47
|
+
// radialSegments
|
|
48
|
+
|
|
49
|
+
const radialSegmentsRow = new UIRow();
|
|
50
|
+
const radialSegments = new UIInteger( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
|
|
51
|
+
|
|
52
|
+
radialSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/capsule_geometry/radialseg' ) ).setClass( 'Label' ) );
|
|
53
|
+
radialSegmentsRow.add( radialSegments );
|
|
54
|
+
|
|
55
|
+
container.add( radialSegmentsRow );
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
|
|
59
|
+
function refreshUI() {
|
|
60
|
+
|
|
61
|
+
const parameters = object.geometry.parameters;
|
|
62
|
+
|
|
63
|
+
radius.setValue( parameters.radius );
|
|
64
|
+
length.setValue( parameters.length );
|
|
65
|
+
capSegments.setValue( parameters.capSegments );
|
|
66
|
+
radialSegments.setValue( parameters.radialSegments );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
71
|
+
|
|
72
|
+
if ( mesh === object ) {
|
|
73
|
+
|
|
74
|
+
refreshUI();
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
} );
|
|
79
|
+
|
|
80
|
+
//
|
|
81
|
+
|
|
82
|
+
function update() {
|
|
83
|
+
|
|
84
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.CapsuleGeometry(
|
|
85
|
+
radius.getValue(),
|
|
86
|
+
length.getValue(),
|
|
87
|
+
capSegments.getValue(),
|
|
88
|
+
radialSegments.getValue()
|
|
89
|
+
) ) );
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return container;
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,97 @@
|
|
|
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/circle_geometry/radius' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusRow.add( radius );
|
|
24
|
+
|
|
25
|
+
container.add( radiusRow );
|
|
26
|
+
|
|
27
|
+
// segments
|
|
28
|
+
|
|
29
|
+
const segmentsRow = new UIRow();
|
|
30
|
+
const segments = new UIInteger( parameters.segments ).setRange( 3, Infinity ).onChange( update );
|
|
31
|
+
|
|
32
|
+
segmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/segments' ) ).setClass( 'Label' ) );
|
|
33
|
+
segmentsRow.add( segments );
|
|
34
|
+
|
|
35
|
+
container.add( segmentsRow );
|
|
36
|
+
|
|
37
|
+
// thetaStart
|
|
38
|
+
|
|
39
|
+
const thetaStartRow = new UIRow();
|
|
40
|
+
const thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
41
|
+
|
|
42
|
+
thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetastart' ) ).setClass( 'Label' ) );
|
|
43
|
+
thetaStartRow.add( thetaStart );
|
|
44
|
+
|
|
45
|
+
container.add( thetaStartRow );
|
|
46
|
+
|
|
47
|
+
// thetaLength
|
|
48
|
+
|
|
49
|
+
const thetaLengthRow = new UIRow();
|
|
50
|
+
const thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setUnit( '°' ).setStep( 10 ).onChange( update );
|
|
51
|
+
|
|
52
|
+
thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetalength' ) ).setClass( 'Label' ) );
|
|
53
|
+
thetaLengthRow.add( thetaLength );
|
|
54
|
+
|
|
55
|
+
container.add( thetaLengthRow );
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
|
|
59
|
+
function refreshUI() {
|
|
60
|
+
|
|
61
|
+
const parameters = object.geometry.parameters;
|
|
62
|
+
|
|
63
|
+
radius.setValue( parameters.radius );
|
|
64
|
+
segments.setValue( parameters.segments );
|
|
65
|
+
thetaStart.setValue( parameters.thetaStart * THREE.MathUtils.RAD2DEG );
|
|
66
|
+
thetaLength.setValue( parameters.thetaLength * THREE.MathUtils.RAD2DEG );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
71
|
+
|
|
72
|
+
if ( mesh === object ) {
|
|
73
|
+
|
|
74
|
+
refreshUI();
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
} );
|
|
79
|
+
|
|
80
|
+
//
|
|
81
|
+
|
|
82
|
+
function update() {
|
|
83
|
+
|
|
84
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.CircleGeometry(
|
|
85
|
+
radius.getValue(),
|
|
86
|
+
segments.getValue(),
|
|
87
|
+
thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
88
|
+
thetaLength.getValue() * THREE.MathUtils.DEG2RAD
|
|
89
|
+
) ) );
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return container;
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UICheckbox, 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
|
+
// radiusTop
|
|
18
|
+
|
|
19
|
+
const radiusTopRow = new UIRow();
|
|
20
|
+
const radiusTop = new UINumber( parameters.radiusTop ).onChange( update );
|
|
21
|
+
|
|
22
|
+
radiusTopRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radiustop' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusTopRow.add( radiusTop );
|
|
24
|
+
|
|
25
|
+
container.add( radiusTopRow );
|
|
26
|
+
|
|
27
|
+
// radiusBottom
|
|
28
|
+
|
|
29
|
+
const radiusBottomRow = new UIRow();
|
|
30
|
+
const radiusBottom = new UINumber( parameters.radiusBottom ).onChange( update );
|
|
31
|
+
|
|
32
|
+
radiusBottomRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radiusbottom' ) ).setClass( 'Label' ) );
|
|
33
|
+
radiusBottomRow.add( radiusBottom );
|
|
34
|
+
|
|
35
|
+
container.add( radiusBottomRow );
|
|
36
|
+
|
|
37
|
+
// height
|
|
38
|
+
|
|
39
|
+
const heightRow = new UIRow();
|
|
40
|
+
const height = new UINumber( parameters.height ).onChange( update );
|
|
41
|
+
|
|
42
|
+
heightRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/height' ) ).setClass( 'Label' ) );
|
|
43
|
+
heightRow.add( height );
|
|
44
|
+
|
|
45
|
+
container.add( heightRow );
|
|
46
|
+
|
|
47
|
+
// radialSegments
|
|
48
|
+
|
|
49
|
+
const radialSegmentsRow = new UIRow();
|
|
50
|
+
const radialSegments = new UIInteger( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
|
|
51
|
+
|
|
52
|
+
radialSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radialsegments' ) ).setClass( 'Label' ) );
|
|
53
|
+
radialSegmentsRow.add( radialSegments );
|
|
54
|
+
|
|
55
|
+
container.add( radialSegmentsRow );
|
|
56
|
+
|
|
57
|
+
// heightSegments
|
|
58
|
+
|
|
59
|
+
const heightSegmentsRow = new UIRow();
|
|
60
|
+
const heightSegments = new UIInteger( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
|
|
61
|
+
|
|
62
|
+
heightSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/heightsegments' ) ).setClass( 'Label' ) );
|
|
63
|
+
heightSegmentsRow.add( heightSegments );
|
|
64
|
+
|
|
65
|
+
container.add( heightSegmentsRow );
|
|
66
|
+
|
|
67
|
+
// openEnded
|
|
68
|
+
|
|
69
|
+
const openEndedRow = new UIRow();
|
|
70
|
+
const openEnded = new UICheckbox( parameters.openEnded ).onChange( update );
|
|
71
|
+
|
|
72
|
+
openEndedRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/openended' ) ).setClass( 'Label' ) );
|
|
73
|
+
openEndedRow.add( openEnded );
|
|
74
|
+
|
|
75
|
+
container.add( openEndedRow );
|
|
76
|
+
|
|
77
|
+
//
|
|
78
|
+
|
|
79
|
+
function refreshUI() {
|
|
80
|
+
|
|
81
|
+
const parameters = object.geometry.parameters;
|
|
82
|
+
|
|
83
|
+
radiusTop.setValue( parameters.radiusTop );
|
|
84
|
+
radiusBottom.setValue( parameters.radiusBottom );
|
|
85
|
+
height.setValue( parameters.height );
|
|
86
|
+
radialSegments.setValue( parameters.radialSegments );
|
|
87
|
+
heightSegments.setValue( parameters.heightSegments );
|
|
88
|
+
openEnded.setValue( parameters.openEnded );
|
|
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.CylinderGeometry(
|
|
107
|
+
radiusTop.getValue(),
|
|
108
|
+
radiusBottom.getValue(),
|
|
109
|
+
height.getValue(),
|
|
110
|
+
radialSegments.getValue(),
|
|
111
|
+
heightSegments.getValue(),
|
|
112
|
+
openEnded.getValue()
|
|
113
|
+
) ) );
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return container;
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,73 @@
|
|
|
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/dodecahedron_geometry/radius' ) ).setClass( 'Label' ) );
|
|
23
|
+
radiusRow.add( radius );
|
|
24
|
+
|
|
25
|
+
container.add( radiusRow );
|
|
26
|
+
|
|
27
|
+
// detail
|
|
28
|
+
|
|
29
|
+
const detailRow = new UIRow();
|
|
30
|
+
const detail = new UIInteger( parameters.detail ).setRange( 0, Infinity ).onChange( update );
|
|
31
|
+
|
|
32
|
+
detailRow.add( new UIText( strings.getKey( 'sidebar/geometry/dodecahedron_geometry/detail' ) ).setClass( 'Label' ) );
|
|
33
|
+
detailRow.add( detail );
|
|
34
|
+
|
|
35
|
+
container.add( detailRow );
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
function refreshUI() {
|
|
40
|
+
|
|
41
|
+
const parameters = object.geometry.parameters;
|
|
42
|
+
|
|
43
|
+
radius.setValue( parameters.radius );
|
|
44
|
+
detail.setValue( parameters.detail );
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
49
|
+
|
|
50
|
+
if ( mesh === object ) {
|
|
51
|
+
|
|
52
|
+
refreshUI();
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
//
|
|
59
|
+
|
|
60
|
+
function update() {
|
|
61
|
+
|
|
62
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.DodecahedronGeometry(
|
|
63
|
+
radius.getValue(),
|
|
64
|
+
detail.getValue()
|
|
65
|
+
) ) );
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return container;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UICheckbox, UIButton, 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
|
+
const options = parameters.options;
|
|
17
|
+
options.curveSegments = options.curveSegments != undefined ? options.curveSegments : 12;
|
|
18
|
+
options.steps = options.steps != undefined ? options.steps : 1;
|
|
19
|
+
options.depth = options.depth != undefined ? options.depth : 1;
|
|
20
|
+
const bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;
|
|
21
|
+
options.bevelThickness = bevelThickness;
|
|
22
|
+
options.bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;
|
|
23
|
+
options.bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
|
|
24
|
+
options.bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// curveSegments
|
|
28
|
+
|
|
29
|
+
const curveSegmentsRow = new UIRow();
|
|
30
|
+
const curveSegments = new UIInteger( options.curveSegments ).onChange( update ).setRange( 1, Infinity );
|
|
31
|
+
|
|
32
|
+
curveSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/curveSegments' ) ).setClass( 'Label' ) );
|
|
33
|
+
curveSegmentsRow.add( curveSegments );
|
|
34
|
+
|
|
35
|
+
container.add( curveSegmentsRow );
|
|
36
|
+
|
|
37
|
+
// steps
|
|
38
|
+
|
|
39
|
+
const stepsRow = new UIRow();
|
|
40
|
+
const steps = new UIInteger( options.steps ).onChange( update ).setRange( 1, Infinity );
|
|
41
|
+
|
|
42
|
+
stepsRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/steps' ) ).setClass( 'Label' ) );
|
|
43
|
+
stepsRow.add( steps );
|
|
44
|
+
|
|
45
|
+
container.add( stepsRow );
|
|
46
|
+
|
|
47
|
+
// depth
|
|
48
|
+
|
|
49
|
+
const depthRow = new UIRow();
|
|
50
|
+
const depth = new UINumber( options.depth ).onChange( update ).setRange( 1, Infinity );
|
|
51
|
+
|
|
52
|
+
depthRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/depth' ) ).setClass( 'Label' ) );
|
|
53
|
+
depthRow.add( depth );
|
|
54
|
+
|
|
55
|
+
container.add( depthRow );
|
|
56
|
+
|
|
57
|
+
// enabled
|
|
58
|
+
|
|
59
|
+
const enabledRow = new UIRow();
|
|
60
|
+
const enabled = new UICheckbox( options.bevelEnabled ).onChange( update );
|
|
61
|
+
|
|
62
|
+
enabledRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelEnabled' ) ).setClass( 'Label' ) );
|
|
63
|
+
enabledRow.add( enabled );
|
|
64
|
+
|
|
65
|
+
container.add( enabledRow );
|
|
66
|
+
|
|
67
|
+
// thickness
|
|
68
|
+
|
|
69
|
+
const thicknessRow = new UIRow();
|
|
70
|
+
const thickness = new UINumber( options.bevelThickness ).onChange( update );
|
|
71
|
+
|
|
72
|
+
thicknessRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelThickness' ) ).setClass( 'Label' ) );
|
|
73
|
+
thicknessRow.add( thickness );
|
|
74
|
+
|
|
75
|
+
container.add( thicknessRow );
|
|
76
|
+
|
|
77
|
+
// size
|
|
78
|
+
|
|
79
|
+
const sizeRow = new UIRow();
|
|
80
|
+
const size = new UINumber( options.bevelSize ).onChange( update );
|
|
81
|
+
|
|
82
|
+
sizeRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelSize' ) ).setClass( 'Label' ) );
|
|
83
|
+
sizeRow.add( size );
|
|
84
|
+
|
|
85
|
+
container.add( sizeRow );
|
|
86
|
+
|
|
87
|
+
// offset
|
|
88
|
+
|
|
89
|
+
const offsetRow = new UIRow();
|
|
90
|
+
const offset = new UINumber( options.bevelOffset ).onChange( update );
|
|
91
|
+
|
|
92
|
+
offsetRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelOffset' ) ).setClass( 'Label' ) );
|
|
93
|
+
offsetRow.add( offset );
|
|
94
|
+
|
|
95
|
+
container.add( offsetRow );
|
|
96
|
+
|
|
97
|
+
// segments
|
|
98
|
+
|
|
99
|
+
const segmentsRow = new UIRow();
|
|
100
|
+
const segments = new UIInteger( options.bevelSegments ).onChange( update ).setRange( 0, Infinity );
|
|
101
|
+
|
|
102
|
+
segmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelSegments' ) ).setClass( 'Label' ) );
|
|
103
|
+
segmentsRow.add( segments );
|
|
104
|
+
|
|
105
|
+
container.add( segmentsRow );
|
|
106
|
+
|
|
107
|
+
updateBevelRow( options.bevelEnabled );
|
|
108
|
+
|
|
109
|
+
const button = new UIButton( strings.getKey( 'sidebar/geometry/extrude_geometry/shape' ) ).onClick( toShape ).setClass( 'Label' ).setMarginLeft( '120px' );
|
|
110
|
+
container.add( button );
|
|
111
|
+
|
|
112
|
+
//
|
|
113
|
+
|
|
114
|
+
function updateBevelRow( enabled ) {
|
|
115
|
+
|
|
116
|
+
if ( enabled === true ) {
|
|
117
|
+
|
|
118
|
+
thicknessRow.setDisplay( '' );
|
|
119
|
+
sizeRow.setDisplay( '' );
|
|
120
|
+
offsetRow.setDisplay( '' );
|
|
121
|
+
segmentsRow.setDisplay( '' );
|
|
122
|
+
|
|
123
|
+
} else {
|
|
124
|
+
|
|
125
|
+
thicknessRow.setDisplay( 'none' );
|
|
126
|
+
sizeRow.setDisplay( 'none' );
|
|
127
|
+
offsetRow.setDisplay( 'none' );
|
|
128
|
+
segmentsRow.setDisplay( 'none' );
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function refreshUI() {
|
|
135
|
+
|
|
136
|
+
const options = object.geometry.parameters.options;
|
|
137
|
+
|
|
138
|
+
curveSegments.setValue( options.curveSegments );
|
|
139
|
+
steps.setValue( options.steps );
|
|
140
|
+
depth.setValue( options.depth );
|
|
141
|
+
enabled.setValue( options.bevelEnabled );
|
|
142
|
+
thickness.setValue( options.bevelThickness );
|
|
143
|
+
size.setValue( options.bevelSize );
|
|
144
|
+
offset.setValue( options.bevelOffset );
|
|
145
|
+
segments.setValue( options.bevelSegments );
|
|
146
|
+
|
|
147
|
+
updateBevelRow( options.bevelEnabled );
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
152
|
+
|
|
153
|
+
if ( mesh === object ) {
|
|
154
|
+
|
|
155
|
+
refreshUI();
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
} );
|
|
160
|
+
|
|
161
|
+
//
|
|
162
|
+
|
|
163
|
+
function update() {
|
|
164
|
+
|
|
165
|
+
updateBevelRow( enabled.getValue() );
|
|
166
|
+
|
|
167
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeGeometry(
|
|
168
|
+
parameters.shapes,
|
|
169
|
+
{
|
|
170
|
+
curveSegments: curveSegments.getValue(),
|
|
171
|
+
steps: steps.getValue(),
|
|
172
|
+
depth: depth.getValue(),
|
|
173
|
+
bevelEnabled: enabled.getValue(),
|
|
174
|
+
bevelThickness: thickness !== undefined ? thickness.getValue() : options.bevelThickness,
|
|
175
|
+
bevelSize: size !== undefined ? size.getValue() : options.bevelSize,
|
|
176
|
+
bevelOffset: offset !== undefined ? offset.getValue() : options.bevelOffset,
|
|
177
|
+
bevelSegments: segments !== undefined ? segments.getValue() : options.bevelSegments
|
|
178
|
+
}
|
|
179
|
+
) ) );
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function toShape() {
|
|
184
|
+
|
|
185
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeGeometry(
|
|
186
|
+
parameters.shapes,
|
|
187
|
+
options.curveSegments
|
|
188
|
+
) ) );
|
|
189
|
+
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return container;
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { GeometryParametersPanel };
|