spoint 0.1.0 → 0.1.10
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 +28 -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,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/icosahedron_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/icosahedron_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.IcosahedronGeometry(
|
|
63
|
+
radius.getValue(),
|
|
64
|
+
detail.getValue()
|
|
65
|
+
) ) );
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return container;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
|
|
4
|
+
import { UIPoints2 } from './libs/ui.three.js';
|
|
5
|
+
|
|
6
|
+
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
7
|
+
|
|
8
|
+
function GeometryParametersPanel( editor, object ) {
|
|
9
|
+
|
|
10
|
+
const strings = editor.strings;
|
|
11
|
+
const signals = editor.signals;
|
|
12
|
+
|
|
13
|
+
const container = new UIDiv();
|
|
14
|
+
|
|
15
|
+
const geometry = object.geometry;
|
|
16
|
+
const parameters = geometry.parameters;
|
|
17
|
+
|
|
18
|
+
// segments
|
|
19
|
+
|
|
20
|
+
const segmentsRow = new UIRow();
|
|
21
|
+
const segments = new UIInteger( parameters.segments ).onChange( update );
|
|
22
|
+
|
|
23
|
+
segmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/segments' ) ).setClass( 'Label' ) );
|
|
24
|
+
segmentsRow.add( segments );
|
|
25
|
+
|
|
26
|
+
container.add( segmentsRow );
|
|
27
|
+
|
|
28
|
+
// phiStart
|
|
29
|
+
|
|
30
|
+
const phiStartRow = new UIRow();
|
|
31
|
+
const phiStart = new UINumber( parameters.phiStart * THREE.MathUtils.RAD2DEG ).onChange( update );
|
|
32
|
+
|
|
33
|
+
phiStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/phistart' ) ).setClass( 'Label' ) );
|
|
34
|
+
phiStartRow.add( phiStart );
|
|
35
|
+
|
|
36
|
+
container.add( phiStartRow );
|
|
37
|
+
|
|
38
|
+
// phiLength
|
|
39
|
+
|
|
40
|
+
const phiLengthRow = new UIRow();
|
|
41
|
+
const phiLength = new UINumber( parameters.phiLength * THREE.MathUtils.RAD2DEG ).onChange( update );
|
|
42
|
+
|
|
43
|
+
phiLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/philength' ) ).setClass( 'Label' ) );
|
|
44
|
+
phiLengthRow.add( phiLength );
|
|
45
|
+
|
|
46
|
+
container.add( phiLengthRow );
|
|
47
|
+
|
|
48
|
+
// points
|
|
49
|
+
|
|
50
|
+
const pointsRow = new UIRow();
|
|
51
|
+
pointsRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/points' ) ).setClass( 'Label' ) );
|
|
52
|
+
|
|
53
|
+
const points = new UIPoints2().setValue( parameters.points ).onChange( update );
|
|
54
|
+
pointsRow.add( points );
|
|
55
|
+
|
|
56
|
+
container.add( pointsRow );
|
|
57
|
+
|
|
58
|
+
//
|
|
59
|
+
|
|
60
|
+
function refreshUI() {
|
|
61
|
+
|
|
62
|
+
const parameters = object.geometry.parameters;
|
|
63
|
+
|
|
64
|
+
points.setValue( parameters.points, false );
|
|
65
|
+
segments.setValue( parameters.segments );
|
|
66
|
+
phiStart.setValue( parameters.phiStart * THREE.MathUtils.RAD2DEG );
|
|
67
|
+
phiLength.setValue( parameters.phiLength * THREE.MathUtils.RAD2DEG );
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
signals.geometryChanged.add( function ( mesh ) {
|
|
72
|
+
|
|
73
|
+
if ( mesh === object ) {
|
|
74
|
+
|
|
75
|
+
refreshUI();
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
} );
|
|
80
|
+
|
|
81
|
+
//
|
|
82
|
+
|
|
83
|
+
function update() {
|
|
84
|
+
|
|
85
|
+
editor.execute( new SetGeometryCommand( editor, object, new THREE.LatheGeometry(
|
|
86
|
+
points.getValue(),
|
|
87
|
+
segments.getValue(),
|
|
88
|
+
phiStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
89
|
+
phiLength.getValue() * THREE.MathUtils.DEG2RAD
|
|
90
|
+
) ) );
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return container;
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { GeometryParametersPanel };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { UIDiv, UIButton, UIRow } from './libs/ui.js';
|
|
2
|
+
|
|
3
|
+
import { computeMikkTSpaceTangents } from 'three/addons/utils/BufferGeometryUtils.js';
|
|
4
|
+
import * as MikkTSpace from 'three/addons/libs/mikktspace.module.js';
|
|
5
|
+
|
|
6
|
+
function SidebarGeometryModifiers( editor, object ) {
|
|
7
|
+
|
|
8
|
+
const strings = editor.strings;
|
|
9
|
+
|
|
10
|
+
const signals = editor.signals;
|
|
11
|
+
|
|
12
|
+
const container = new UIDiv().setMarginLeft( '120px' );
|
|
13
|
+
|
|
14
|
+
const geometry = object.geometry;
|
|
15
|
+
|
|
16
|
+
// Compute Vertex Normals
|
|
17
|
+
|
|
18
|
+
const computeVertexNormalsButton = new UIButton( strings.getKey( 'sidebar/geometry/compute_vertex_normals' ) );
|
|
19
|
+
computeVertexNormalsButton.onClick( function () {
|
|
20
|
+
|
|
21
|
+
geometry.computeVertexNormals();
|
|
22
|
+
|
|
23
|
+
signals.geometryChanged.dispatch( object );
|
|
24
|
+
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
const computeVertexNormalsRow = new UIRow();
|
|
28
|
+
computeVertexNormalsRow.add( computeVertexNormalsButton );
|
|
29
|
+
container.add( computeVertexNormalsRow );
|
|
30
|
+
|
|
31
|
+
// Compute Vertex Tangents
|
|
32
|
+
|
|
33
|
+
if ( geometry.hasAttribute( 'position' ) && geometry.hasAttribute( 'normal' ) && geometry.hasAttribute( 'uv' ) ) {
|
|
34
|
+
|
|
35
|
+
const computeVertexTangentsButton = new UIButton( strings.getKey( 'sidebar/geometry/compute_vertex_tangents' ) );
|
|
36
|
+
computeVertexTangentsButton.onClick( async function () {
|
|
37
|
+
|
|
38
|
+
await MikkTSpace.ready;
|
|
39
|
+
|
|
40
|
+
computeMikkTSpaceTangents( geometry, MikkTSpace );
|
|
41
|
+
|
|
42
|
+
signals.geometryChanged.dispatch( object );
|
|
43
|
+
|
|
44
|
+
} );
|
|
45
|
+
|
|
46
|
+
const computeVertexTangentsRow = new UIRow();
|
|
47
|
+
computeVertexTangentsRow.add( computeVertexTangentsButton );
|
|
48
|
+
container.add( computeVertexTangentsRow );
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Center Geometry
|
|
53
|
+
|
|
54
|
+
const centerButton = new UIButton( strings.getKey( 'sidebar/geometry/center' ) );
|
|
55
|
+
centerButton.onClick( function () {
|
|
56
|
+
|
|
57
|
+
geometry.center();
|
|
58
|
+
|
|
59
|
+
signals.geometryChanged.dispatch( object );
|
|
60
|
+
|
|
61
|
+
} );
|
|
62
|
+
|
|
63
|
+
const centerRow = new UIRow();
|
|
64
|
+
centerRow.add( centerButton );
|
|
65
|
+
container.add( centerRow );
|
|
66
|
+
|
|
67
|
+
//
|
|
68
|
+
|
|
69
|
+
return container;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { SidebarGeometryModifiers };
|
|
@@ -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/octahedron_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/octahedron_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.OctahedronGeometry(
|
|
64
|
+
radius.getValue(),
|
|
65
|
+
detail.getValue()
|
|
66
|
+
) ) );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return container;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
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
|
+
// width
|
|
18
|
+
|
|
19
|
+
const widthRow = new UIRow();
|
|
20
|
+
const width = new UINumber( parameters.width ).onChange( update );
|
|
21
|
+
|
|
22
|
+
widthRow.add( new UIText( strings.getKey( 'sidebar/geometry/plane_geometry/width' ) ).setClass( 'Label' ) );
|
|
23
|
+
widthRow.add( width );
|
|
24
|
+
|
|
25
|
+
container.add( widthRow );
|
|
26
|
+
|
|
27
|
+
// height
|
|
28
|
+
|
|
29
|
+
const heightRow = new UIRow();
|
|
30
|
+
const height = new UINumber( parameters.height ).onChange( update );
|
|
31
|
+
|
|
32
|
+
heightRow.add( new UIText( strings.getKey( 'sidebar/geometry/plane_geometry/height' ) ).setClass( 'Label' ) );
|
|
33
|
+
heightRow.add( height );
|
|
34
|
+
|
|
35
|
+
container.add( heightRow );
|
|
36
|
+
|
|
37
|
+
// widthSegments
|
|
38
|
+
|
|
39
|
+
const widthSegmentsRow = new UIRow();
|
|
40
|
+
const widthSegments = new UIInteger( parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
|
|
41
|
+
|
|
42
|
+
widthSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/plane_geometry/widthsegments' ) ).setClass( 'Label' ) );
|
|
43
|
+
widthSegmentsRow.add( widthSegments );
|
|
44
|
+
|
|
45
|
+
container.add( widthSegmentsRow );
|
|
46
|
+
|
|
47
|
+
// heightSegments
|
|
48
|
+
|
|
49
|
+
const heightSegmentsRow = new UIRow();
|
|
50
|
+
const heightSegments = new UIInteger( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
|
|
51
|
+
|
|
52
|
+
heightSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/plane_geometry/heightsegments' ) ).setClass( 'Label' ) );
|
|
53
|
+
heightSegmentsRow.add( heightSegments );
|
|
54
|
+
|
|
55
|
+
container.add( heightSegmentsRow );
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
|
|
59
|
+
function refreshUI() {
|
|
60
|
+
|
|
61
|
+
const parameters = object.geometry.parameters;
|
|
62
|
+
|
|
63
|
+
width.setValue( parameters.width );
|
|
64
|
+
height.setValue( parameters.height );
|
|
65
|
+
widthSegments.setValue( parameters.widthSegments );
|
|
66
|
+
heightSegments.setValue( parameters.heightSegments );
|
|
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.PlaneGeometry(
|
|
85
|
+
width.getValue(),
|
|
86
|
+
height.getValue(),
|
|
87
|
+
widthSegments.getValue(),
|
|
88
|
+
heightSegments.getValue()
|
|
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, 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 };
|