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,751 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
import { UIButton, UIInput, UIPanel, UIRow, UISelect, UIText, UITextArea } from './libs/ui.js';
|
|
4
|
+
|
|
5
|
+
import { SetMaterialCommand } from './commands/SetMaterialCommand.js';
|
|
6
|
+
import { SetMaterialValueCommand } from './commands/SetMaterialValueCommand.js';
|
|
7
|
+
|
|
8
|
+
import { SidebarMaterialBooleanProperty } from './Sidebar.Material.BooleanProperty.js';
|
|
9
|
+
import { SidebarMaterialColorProperty } from './Sidebar.Material.ColorProperty.js';
|
|
10
|
+
import { SidebarMaterialConstantProperty } from './Sidebar.Material.ConstantProperty.js';
|
|
11
|
+
import { SidebarMaterialMapProperty } from './Sidebar.Material.MapProperty.js';
|
|
12
|
+
import { SidebarMaterialNumberProperty } from './Sidebar.Material.NumberProperty.js';
|
|
13
|
+
import { SidebarMaterialRangeValueProperty } from './Sidebar.Material.RangeValueProperty.js';
|
|
14
|
+
import { SidebarMaterialProgram } from './Sidebar.Material.Program.js';
|
|
15
|
+
|
|
16
|
+
function SidebarMaterial( editor ) {
|
|
17
|
+
|
|
18
|
+
const signals = editor.signals;
|
|
19
|
+
const strings = editor.strings;
|
|
20
|
+
|
|
21
|
+
let currentObject;
|
|
22
|
+
|
|
23
|
+
let currentMaterialSlot = 0;
|
|
24
|
+
|
|
25
|
+
const container = new UIPanel();
|
|
26
|
+
container.setBorderTop( '0' );
|
|
27
|
+
container.setDisplay( 'none' );
|
|
28
|
+
container.setPaddingTop( '20px' );
|
|
29
|
+
|
|
30
|
+
// Current material slot
|
|
31
|
+
|
|
32
|
+
const materialSlotRow = new UIRow();
|
|
33
|
+
|
|
34
|
+
materialSlotRow.add( new UIText( strings.getKey( 'sidebar/material/slot' ) ).setClass( 'Label' ) );
|
|
35
|
+
|
|
36
|
+
const materialSlotSelect = new UISelect().setWidth( '170px' ).setFontSize( '12px' ).onChange( update );
|
|
37
|
+
materialSlotSelect.setOptions( { 0: '' } ).setValue( 0 );
|
|
38
|
+
materialSlotRow.add( materialSlotSelect );
|
|
39
|
+
|
|
40
|
+
container.add( materialSlotRow );
|
|
41
|
+
|
|
42
|
+
// type
|
|
43
|
+
|
|
44
|
+
const materialClassRow = new UIRow();
|
|
45
|
+
const materialClass = new UISelect().setWidth( '150px' ).setFontSize( '12px' ).onChange( update );
|
|
46
|
+
|
|
47
|
+
materialClassRow.add( new UIText( strings.getKey( 'sidebar/material/type' ) ).setClass( 'Label' ) );
|
|
48
|
+
materialClassRow.add( materialClass );
|
|
49
|
+
|
|
50
|
+
container.add( materialClassRow );
|
|
51
|
+
|
|
52
|
+
// uuid
|
|
53
|
+
|
|
54
|
+
const materialUUIDRow = new UIRow();
|
|
55
|
+
const materialUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );
|
|
56
|
+
const materialUUIDRenew = new UIButton( strings.getKey( 'sidebar/material/new' ) ).setMarginLeft( '7px' );
|
|
57
|
+
materialUUIDRenew.onClick( function () {
|
|
58
|
+
|
|
59
|
+
materialUUID.setValue( THREE.MathUtils.generateUUID() );
|
|
60
|
+
update();
|
|
61
|
+
|
|
62
|
+
} );
|
|
63
|
+
|
|
64
|
+
materialUUIDRow.add( new UIText( strings.getKey( 'sidebar/material/uuid' ) ).setClass( 'Label' ) );
|
|
65
|
+
materialUUIDRow.add( materialUUID );
|
|
66
|
+
materialUUIDRow.add( materialUUIDRenew );
|
|
67
|
+
|
|
68
|
+
container.add( materialUUIDRow );
|
|
69
|
+
|
|
70
|
+
// name
|
|
71
|
+
|
|
72
|
+
const materialNameRow = new UIRow();
|
|
73
|
+
const materialName = new UIInput().setWidth( '150px' ).setFontSize( '12px' ).onChange( function () {
|
|
74
|
+
|
|
75
|
+
editor.execute( new SetMaterialValueCommand( editor, editor.selected, 'name', materialName.getValue(), currentMaterialSlot ) );
|
|
76
|
+
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
materialNameRow.add( new UIText( strings.getKey( 'sidebar/material/name' ) ).setClass( 'Label' ) );
|
|
80
|
+
materialNameRow.add( materialName );
|
|
81
|
+
|
|
82
|
+
container.add( materialNameRow );
|
|
83
|
+
|
|
84
|
+
// program
|
|
85
|
+
|
|
86
|
+
const materialProgram = new SidebarMaterialProgram( editor, 'vertexShader' );
|
|
87
|
+
container.add( materialProgram );
|
|
88
|
+
|
|
89
|
+
// color
|
|
90
|
+
|
|
91
|
+
const materialColor = new SidebarMaterialColorProperty( editor, 'color', strings.getKey( 'sidebar/material/color' ) );
|
|
92
|
+
container.add( materialColor );
|
|
93
|
+
|
|
94
|
+
// specular
|
|
95
|
+
|
|
96
|
+
const materialSpecular = new SidebarMaterialColorProperty( editor, 'specular', strings.getKey( 'sidebar/material/specular' ) );
|
|
97
|
+
container.add( materialSpecular );
|
|
98
|
+
|
|
99
|
+
// shininess
|
|
100
|
+
|
|
101
|
+
const materialShininess = new SidebarMaterialNumberProperty( editor, 'shininess', strings.getKey( 'sidebar/material/shininess' ) );
|
|
102
|
+
container.add( materialShininess );
|
|
103
|
+
|
|
104
|
+
// emissive
|
|
105
|
+
|
|
106
|
+
const materialEmissive = new SidebarMaterialColorProperty( editor, 'emissive', strings.getKey( 'sidebar/material/emissive' ) );
|
|
107
|
+
container.add( materialEmissive );
|
|
108
|
+
|
|
109
|
+
// reflectivity
|
|
110
|
+
|
|
111
|
+
const materialReflectivity = new SidebarMaterialNumberProperty( editor, 'reflectivity', strings.getKey( 'sidebar/material/reflectivity' ) );
|
|
112
|
+
container.add( materialReflectivity );
|
|
113
|
+
|
|
114
|
+
// ior
|
|
115
|
+
|
|
116
|
+
const materialIOR = new SidebarMaterialNumberProperty( editor, 'ior', strings.getKey( 'sidebar/material/ior' ), [ 1, 2.333 ], 3 );
|
|
117
|
+
container.add( materialIOR );
|
|
118
|
+
|
|
119
|
+
// roughness
|
|
120
|
+
|
|
121
|
+
const materialRoughness = new SidebarMaterialNumberProperty( editor, 'roughness', strings.getKey( 'sidebar/material/roughness' ), [ 0, 1 ] );
|
|
122
|
+
container.add( materialRoughness );
|
|
123
|
+
|
|
124
|
+
// metalness
|
|
125
|
+
|
|
126
|
+
const materialMetalness = new SidebarMaterialNumberProperty( editor, 'metalness', strings.getKey( 'sidebar/material/metalness' ), [ 0, 1 ] );
|
|
127
|
+
container.add( materialMetalness );
|
|
128
|
+
|
|
129
|
+
// clearcoat
|
|
130
|
+
|
|
131
|
+
const materialClearcoat = new SidebarMaterialNumberProperty( editor, 'clearcoat', strings.getKey( 'sidebar/material/clearcoat' ), [ 0, 1 ] );
|
|
132
|
+
container.add( materialClearcoat );
|
|
133
|
+
|
|
134
|
+
// clearcoatRoughness
|
|
135
|
+
|
|
136
|
+
const materialClearcoatRoughness = new SidebarMaterialNumberProperty( editor, 'clearcoatRoughness', strings.getKey( 'sidebar/material/clearcoatroughness' ), [ 0, 1 ] );
|
|
137
|
+
container.add( materialClearcoatRoughness );
|
|
138
|
+
|
|
139
|
+
// dispersion
|
|
140
|
+
|
|
141
|
+
const materialDispersion = new SidebarMaterialNumberProperty( editor, 'dispersion', strings.getKey( 'sidebar/material/dispersion' ), [ 0, 10 ] );
|
|
142
|
+
container.add( materialDispersion );
|
|
143
|
+
|
|
144
|
+
// iridescence
|
|
145
|
+
|
|
146
|
+
const materialIridescence = new SidebarMaterialNumberProperty( editor, 'iridescence', strings.getKey( 'sidebar/material/iridescence' ), [ 0, 1 ] );
|
|
147
|
+
container.add( materialIridescence );
|
|
148
|
+
|
|
149
|
+
// iridescenceIOR
|
|
150
|
+
|
|
151
|
+
const materialIridescenceIOR = new SidebarMaterialNumberProperty( editor, 'iridescenceIOR', strings.getKey( 'sidebar/material/iridescenceIOR' ), [ 1, 5 ] );
|
|
152
|
+
container.add( materialIridescenceIOR );
|
|
153
|
+
|
|
154
|
+
// iridescenceThicknessMax
|
|
155
|
+
|
|
156
|
+
const materialIridescenceThicknessMax = new SidebarMaterialRangeValueProperty( editor, 'iridescenceThicknessRange', strings.getKey( 'sidebar/material/iridescenceThicknessMax' ), false, [ 0, Infinity ], 0, 10, 1, 'nm' );
|
|
157
|
+
container.add( materialIridescenceThicknessMax );
|
|
158
|
+
|
|
159
|
+
// sheen
|
|
160
|
+
|
|
161
|
+
const materialSheen = new SidebarMaterialNumberProperty( editor, 'sheen', strings.getKey( 'sidebar/material/sheen' ), [ 0, 1 ] );
|
|
162
|
+
container.add( materialSheen );
|
|
163
|
+
|
|
164
|
+
// sheen roughness
|
|
165
|
+
|
|
166
|
+
const materialSheenRoughness = new SidebarMaterialNumberProperty( editor, 'sheenRoughness', strings.getKey( 'sidebar/material/sheenroughness' ), [ 0, 1 ] );
|
|
167
|
+
container.add( materialSheenRoughness );
|
|
168
|
+
|
|
169
|
+
// sheen color
|
|
170
|
+
|
|
171
|
+
const materialSheenColor = new SidebarMaterialColorProperty( editor, 'sheenColor', strings.getKey( 'sidebar/material/sheencolor' ) );
|
|
172
|
+
container.add( materialSheenColor );
|
|
173
|
+
|
|
174
|
+
// transmission
|
|
175
|
+
|
|
176
|
+
const materialTransmission = new SidebarMaterialNumberProperty( editor, 'transmission', strings.getKey( 'sidebar/material/transmission' ), [ 0, 1 ] );
|
|
177
|
+
container.add( materialTransmission );
|
|
178
|
+
|
|
179
|
+
// attenuation distance
|
|
180
|
+
|
|
181
|
+
const materialAttenuationDistance = new SidebarMaterialNumberProperty( editor, 'attenuationDistance', strings.getKey( 'sidebar/material/attenuationDistance' ) );
|
|
182
|
+
container.add( materialAttenuationDistance );
|
|
183
|
+
|
|
184
|
+
// attenuation tint
|
|
185
|
+
|
|
186
|
+
const materialAttenuationColor = new SidebarMaterialColorProperty( editor, 'attenuationColor', strings.getKey( 'sidebar/material/attenuationColor' ) );
|
|
187
|
+
container.add( materialAttenuationColor );
|
|
188
|
+
|
|
189
|
+
// thickness
|
|
190
|
+
|
|
191
|
+
const materialThickness = new SidebarMaterialNumberProperty( editor, 'thickness', strings.getKey( 'sidebar/material/thickness' ) );
|
|
192
|
+
container.add( materialThickness );
|
|
193
|
+
|
|
194
|
+
// vertex colors
|
|
195
|
+
|
|
196
|
+
const materialVertexColors = new SidebarMaterialBooleanProperty( editor, 'vertexColors', strings.getKey( 'sidebar/material/vertexcolors' ) );
|
|
197
|
+
container.add( materialVertexColors );
|
|
198
|
+
|
|
199
|
+
// depth packing
|
|
200
|
+
|
|
201
|
+
const materialDepthPackingOptions = {
|
|
202
|
+
[ THREE.BasicDepthPacking ]: 'Basic',
|
|
203
|
+
[ THREE.RGBADepthPacking ]: 'RGBA'
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const materialDepthPacking = new SidebarMaterialConstantProperty( editor, 'depthPacking', strings.getKey( 'sidebar/material/depthPacking' ), materialDepthPackingOptions );
|
|
207
|
+
container.add( materialDepthPacking );
|
|
208
|
+
|
|
209
|
+
// map
|
|
210
|
+
|
|
211
|
+
const materialMap = new SidebarMaterialMapProperty( editor, 'map', strings.getKey( 'sidebar/material/map' ) );
|
|
212
|
+
container.add( materialMap );
|
|
213
|
+
|
|
214
|
+
// specular map
|
|
215
|
+
|
|
216
|
+
const materialSpecularMap = new SidebarMaterialMapProperty( editor, 'specularMap', strings.getKey( 'sidebar/material/specularmap' ) );
|
|
217
|
+
container.add( materialSpecularMap );
|
|
218
|
+
|
|
219
|
+
// emissive map
|
|
220
|
+
|
|
221
|
+
const materialEmissiveMap = new SidebarMaterialMapProperty( editor, 'emissiveMap', strings.getKey( 'sidebar/material/emissivemap' ) );
|
|
222
|
+
container.add( materialEmissiveMap );
|
|
223
|
+
|
|
224
|
+
// matcap map
|
|
225
|
+
|
|
226
|
+
const materialMatcapMap = new SidebarMaterialMapProperty( editor, 'matcap', strings.getKey( 'sidebar/material/matcap' ) );
|
|
227
|
+
container.add( materialMatcapMap );
|
|
228
|
+
|
|
229
|
+
// alpha map
|
|
230
|
+
|
|
231
|
+
const materialAlphaMap = new SidebarMaterialMapProperty( editor, 'alphaMap', strings.getKey( 'sidebar/material/alphamap' ) );
|
|
232
|
+
container.add( materialAlphaMap );
|
|
233
|
+
|
|
234
|
+
// bump map
|
|
235
|
+
|
|
236
|
+
const materialBumpMap = new SidebarMaterialMapProperty( editor, 'bumpMap', strings.getKey( 'sidebar/material/bumpmap' ) );
|
|
237
|
+
container.add( materialBumpMap );
|
|
238
|
+
|
|
239
|
+
// normal map
|
|
240
|
+
|
|
241
|
+
const materialNormalMap = new SidebarMaterialMapProperty( editor, 'normalMap', strings.getKey( 'sidebar/material/normalmap' ) );
|
|
242
|
+
container.add( materialNormalMap );
|
|
243
|
+
|
|
244
|
+
// clearcoat map
|
|
245
|
+
|
|
246
|
+
const materialClearcoatMap = new SidebarMaterialMapProperty( editor, 'clearcoatMap', strings.getKey( 'sidebar/material/clearcoatmap' ) );
|
|
247
|
+
container.add( materialClearcoatMap );
|
|
248
|
+
|
|
249
|
+
// clearcoat normal map
|
|
250
|
+
|
|
251
|
+
const materialClearcoatNormalMap = new SidebarMaterialMapProperty( editor, 'clearcoatNormalMap', strings.getKey( 'sidebar/material/clearcoatnormalmap' ) );
|
|
252
|
+
container.add( materialClearcoatNormalMap );
|
|
253
|
+
|
|
254
|
+
// clearcoat roughness map
|
|
255
|
+
|
|
256
|
+
const materialClearcoatRoughnessMap = new SidebarMaterialMapProperty( editor, 'clearcoatRoughnessMap', strings.getKey( 'sidebar/material/clearcoatroughnessmap' ) );
|
|
257
|
+
container.add( materialClearcoatRoughnessMap );
|
|
258
|
+
|
|
259
|
+
// displacement map
|
|
260
|
+
|
|
261
|
+
const materialDisplacementMap = new SidebarMaterialMapProperty( editor, 'displacementMap', strings.getKey( 'sidebar/material/displacementmap' ) );
|
|
262
|
+
container.add( materialDisplacementMap );
|
|
263
|
+
|
|
264
|
+
// roughness map
|
|
265
|
+
|
|
266
|
+
const materialRoughnessMap = new SidebarMaterialMapProperty( editor, 'roughnessMap', strings.getKey( 'sidebar/material/roughnessmap' ) );
|
|
267
|
+
container.add( materialRoughnessMap );
|
|
268
|
+
|
|
269
|
+
// metalness map
|
|
270
|
+
|
|
271
|
+
const materialMetalnessMap = new SidebarMaterialMapProperty( editor, 'metalnessMap', strings.getKey( 'sidebar/material/metalnessmap' ) );
|
|
272
|
+
container.add( materialMetalnessMap );
|
|
273
|
+
|
|
274
|
+
// iridescence map
|
|
275
|
+
|
|
276
|
+
const materialIridescenceMap = new SidebarMaterialMapProperty( editor, 'iridescenceMap', strings.getKey( 'sidebar/material/iridescencemap' ) );
|
|
277
|
+
container.add( materialIridescenceMap );
|
|
278
|
+
|
|
279
|
+
// sheen color map
|
|
280
|
+
|
|
281
|
+
const materialSheenColorMap = new SidebarMaterialMapProperty( editor, 'sheenColorMap', strings.getKey( 'sidebar/material/sheencolormap' ) );
|
|
282
|
+
container.add( materialSheenColorMap );
|
|
283
|
+
|
|
284
|
+
// sheen roughness map
|
|
285
|
+
|
|
286
|
+
const materialSheenRoughnessMap = new SidebarMaterialMapProperty( editor, 'sheenRoughnessMap', strings.getKey( 'sidebar/material/sheenroughnessmap' ) );
|
|
287
|
+
container.add( materialSheenRoughnessMap );
|
|
288
|
+
|
|
289
|
+
// iridescence thickness map
|
|
290
|
+
|
|
291
|
+
const materialIridescenceThicknessMap = new SidebarMaterialMapProperty( editor, 'iridescenceThicknessMap', strings.getKey( 'sidebar/material/iridescencethicknessmap' ) );
|
|
292
|
+
container.add( materialIridescenceThicknessMap );
|
|
293
|
+
|
|
294
|
+
// env map
|
|
295
|
+
|
|
296
|
+
const materialEnvMap = new SidebarMaterialMapProperty( editor, 'envMap', strings.getKey( 'sidebar/material/envmap' ) );
|
|
297
|
+
container.add( materialEnvMap );
|
|
298
|
+
|
|
299
|
+
// light map
|
|
300
|
+
|
|
301
|
+
const materialLightMap = new SidebarMaterialMapProperty( editor, 'lightMap', strings.getKey( 'sidebar/material/lightmap' ) );
|
|
302
|
+
container.add( materialLightMap );
|
|
303
|
+
|
|
304
|
+
// ambient occlusion map
|
|
305
|
+
|
|
306
|
+
const materialAOMap = new SidebarMaterialMapProperty( editor, 'aoMap', strings.getKey( 'sidebar/material/aomap' ) );
|
|
307
|
+
container.add( materialAOMap );
|
|
308
|
+
|
|
309
|
+
// gradient map
|
|
310
|
+
|
|
311
|
+
const materialGradientMap = new SidebarMaterialMapProperty( editor, 'gradientMap', strings.getKey( 'sidebar/material/gradientmap' ) );
|
|
312
|
+
container.add( materialGradientMap );
|
|
313
|
+
|
|
314
|
+
// transmission map
|
|
315
|
+
|
|
316
|
+
const transmissionMap = new SidebarMaterialMapProperty( editor, 'transmissionMap', strings.getKey( 'sidebar/material/transmissionmap' ) );
|
|
317
|
+
container.add( transmissionMap );
|
|
318
|
+
|
|
319
|
+
// thickness map
|
|
320
|
+
|
|
321
|
+
const thicknessMap = new SidebarMaterialMapProperty( editor, 'thicknessMap', strings.getKey( 'sidebar/material/thicknessmap' ) );
|
|
322
|
+
container.add( thicknessMap );
|
|
323
|
+
|
|
324
|
+
// side
|
|
325
|
+
|
|
326
|
+
const materialSideOptions = {
|
|
327
|
+
0: 'Front',
|
|
328
|
+
1: 'Back',
|
|
329
|
+
2: 'Double'
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const materialSide = new SidebarMaterialConstantProperty( editor, 'side', strings.getKey( 'sidebar/material/side' ), materialSideOptions );
|
|
333
|
+
container.add( materialSide );
|
|
334
|
+
|
|
335
|
+
// size
|
|
336
|
+
|
|
337
|
+
const materialSize = new SidebarMaterialNumberProperty( editor, 'size', strings.getKey( 'sidebar/material/size' ), [ 0, Infinity ] );
|
|
338
|
+
container.add( materialSize );
|
|
339
|
+
|
|
340
|
+
// sizeAttenuation
|
|
341
|
+
|
|
342
|
+
const materialSizeAttenuation = new SidebarMaterialBooleanProperty( editor, 'sizeAttenuation', strings.getKey( 'sidebar/material/sizeAttenuation' ) );
|
|
343
|
+
container.add( materialSizeAttenuation );
|
|
344
|
+
|
|
345
|
+
// flatShading
|
|
346
|
+
|
|
347
|
+
const materialFlatShading = new SidebarMaterialBooleanProperty( editor, 'flatShading', strings.getKey( 'sidebar/material/flatShading' ) );
|
|
348
|
+
container.add( materialFlatShading );
|
|
349
|
+
|
|
350
|
+
// blending
|
|
351
|
+
|
|
352
|
+
const materialBlendingOptions = {
|
|
353
|
+
0: 'No',
|
|
354
|
+
1: 'Normal',
|
|
355
|
+
2: 'Additive',
|
|
356
|
+
3: 'Subtractive',
|
|
357
|
+
4: 'Multiply',
|
|
358
|
+
5: 'Custom'
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
const materialBlending = new SidebarMaterialConstantProperty( editor, 'blending', strings.getKey( 'sidebar/material/blending' ), materialBlendingOptions );
|
|
362
|
+
container.add( materialBlending );
|
|
363
|
+
|
|
364
|
+
// opacity
|
|
365
|
+
|
|
366
|
+
const materialOpacity = new SidebarMaterialNumberProperty( editor, 'opacity', strings.getKey( 'sidebar/material/opacity' ), [ 0, 1 ] );
|
|
367
|
+
container.add( materialOpacity );
|
|
368
|
+
|
|
369
|
+
// transparent
|
|
370
|
+
|
|
371
|
+
const materialTransparent = new SidebarMaterialBooleanProperty( editor, 'transparent', strings.getKey( 'sidebar/material/transparent' ) );
|
|
372
|
+
container.add( materialTransparent );
|
|
373
|
+
|
|
374
|
+
// forceSinglePass
|
|
375
|
+
|
|
376
|
+
const materialForceSinglePass = new SidebarMaterialBooleanProperty( editor, 'forceSinglePass', strings.getKey( 'sidebar/material/forcesinglepass' ) );
|
|
377
|
+
container.add( materialForceSinglePass );
|
|
378
|
+
|
|
379
|
+
// alpha test
|
|
380
|
+
|
|
381
|
+
const materialAlphaTest = new SidebarMaterialNumberProperty( editor, 'alphaTest', strings.getKey( 'sidebar/material/alphatest' ), [ 0, 1 ] );
|
|
382
|
+
container.add( materialAlphaTest );
|
|
383
|
+
|
|
384
|
+
// depth test
|
|
385
|
+
|
|
386
|
+
const materialDepthTest = new SidebarMaterialBooleanProperty( editor, 'depthTest', strings.getKey( 'sidebar/material/depthtest' ) );
|
|
387
|
+
container.add( materialDepthTest );
|
|
388
|
+
|
|
389
|
+
// depth write
|
|
390
|
+
|
|
391
|
+
const materialDepthWrite = new SidebarMaterialBooleanProperty( editor, 'depthWrite', strings.getKey( 'sidebar/material/depthwrite' ) );
|
|
392
|
+
container.add( materialDepthWrite );
|
|
393
|
+
|
|
394
|
+
// wireframe
|
|
395
|
+
|
|
396
|
+
const materialWireframe = new SidebarMaterialBooleanProperty( editor, 'wireframe', strings.getKey( 'sidebar/material/wireframe' ) );
|
|
397
|
+
container.add( materialWireframe );
|
|
398
|
+
|
|
399
|
+
// userData
|
|
400
|
+
|
|
401
|
+
const materialUserDataRow = new UIRow();
|
|
402
|
+
const materialUserData = new UITextArea().setWidth( '150px' ).setHeight( '40px' ).setFontSize( '12px' ).onChange( update );
|
|
403
|
+
materialUserData.onKeyUp( function () {
|
|
404
|
+
|
|
405
|
+
try {
|
|
406
|
+
|
|
407
|
+
JSON.parse( materialUserData.getValue() );
|
|
408
|
+
|
|
409
|
+
materialUserData.dom.classList.add( 'success' );
|
|
410
|
+
materialUserData.dom.classList.remove( 'fail' );
|
|
411
|
+
|
|
412
|
+
} catch ( error ) {
|
|
413
|
+
|
|
414
|
+
materialUserData.dom.classList.remove( 'success' );
|
|
415
|
+
materialUserData.dom.classList.add( 'fail' );
|
|
416
|
+
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
} );
|
|
420
|
+
|
|
421
|
+
materialUserDataRow.add( new UIText( strings.getKey( 'sidebar/material/userdata' ) ).setClass( 'Label' ) );
|
|
422
|
+
materialUserDataRow.add( materialUserData );
|
|
423
|
+
|
|
424
|
+
container.add( materialUserDataRow );
|
|
425
|
+
|
|
426
|
+
// Export JSON
|
|
427
|
+
|
|
428
|
+
const exportJson = new UIButton( strings.getKey( 'sidebar/material/export' ) );
|
|
429
|
+
exportJson.setMarginLeft( '120px' );
|
|
430
|
+
exportJson.onClick( function () {
|
|
431
|
+
|
|
432
|
+
const object = editor.selected;
|
|
433
|
+
const material = Array.isArray( object.material ) ? object.material[ currentMaterialSlot ] : object.material;
|
|
434
|
+
|
|
435
|
+
let output = material.toJSON();
|
|
436
|
+
|
|
437
|
+
try {
|
|
438
|
+
|
|
439
|
+
output = JSON.stringify( output, null, '\t' );
|
|
440
|
+
output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
|
|
441
|
+
|
|
442
|
+
} catch ( e ) {
|
|
443
|
+
|
|
444
|
+
output = JSON.stringify( output );
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
editor.utils.save( new Blob( [ output ] ), `${ materialName.getValue() || 'material' }.json` );
|
|
449
|
+
|
|
450
|
+
} );
|
|
451
|
+
container.add( exportJson );
|
|
452
|
+
|
|
453
|
+
//
|
|
454
|
+
|
|
455
|
+
function update() {
|
|
456
|
+
|
|
457
|
+
const previousSelectedSlot = currentMaterialSlot;
|
|
458
|
+
|
|
459
|
+
currentMaterialSlot = parseInt( materialSlotSelect.getValue() );
|
|
460
|
+
|
|
461
|
+
if ( currentMaterialSlot !== previousSelectedSlot ) {
|
|
462
|
+
|
|
463
|
+
editor.signals.materialChanged.dispatch( currentObject, currentMaterialSlot );
|
|
464
|
+
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
let material = editor.getObjectMaterial( currentObject, currentMaterialSlot );
|
|
468
|
+
|
|
469
|
+
if ( material ) {
|
|
470
|
+
|
|
471
|
+
if ( material.uuid !== undefined && material.uuid !== materialUUID.getValue() ) {
|
|
472
|
+
|
|
473
|
+
editor.execute( new SetMaterialValueCommand( editor, currentObject, 'uuid', materialUUID.getValue(), currentMaterialSlot ) );
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if ( material.type !== materialClass.getValue() ) {
|
|
478
|
+
|
|
479
|
+
material = new materialClasses[ materialClass.getValue() ]();
|
|
480
|
+
|
|
481
|
+
if ( material.type === 'RawShaderMaterial' ) {
|
|
482
|
+
|
|
483
|
+
material.vertexShader = vertexShaderVariables + material.vertexShader;
|
|
484
|
+
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const currentMaterial = currentObject.material;
|
|
488
|
+
|
|
489
|
+
if ( material.type === 'MeshPhysicalMaterial' && currentMaterial.type === 'MeshStandardMaterial' ) {
|
|
490
|
+
|
|
491
|
+
// TODO Find a easier to maintain approach
|
|
492
|
+
|
|
493
|
+
const properties = [
|
|
494
|
+
'color', 'emissive', 'roughness', 'metalness', 'map', 'emissiveMap', 'alphaMap',
|
|
495
|
+
'bumpMap', 'normalMap', 'normalScale', 'displacementMap', 'roughnessMap', 'metalnessMap',
|
|
496
|
+
'envMap', 'lightMap', 'aoMap', 'side'
|
|
497
|
+
];
|
|
498
|
+
|
|
499
|
+
for ( const property of properties ) {
|
|
500
|
+
|
|
501
|
+
const value = currentMaterial[ property ];
|
|
502
|
+
|
|
503
|
+
if ( value === null ) continue;
|
|
504
|
+
|
|
505
|
+
if ( value[ 'clone' ] !== undefined ) {
|
|
506
|
+
|
|
507
|
+
material[ property ] = value.clone();
|
|
508
|
+
|
|
509
|
+
} else {
|
|
510
|
+
|
|
511
|
+
material[ property ] = value;
|
|
512
|
+
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
if ( Array.isArray( currentMaterial ) ) {
|
|
520
|
+
|
|
521
|
+
// don't remove the entire multi-material. just the material of the selected slot
|
|
522
|
+
|
|
523
|
+
editor.removeMaterial( currentMaterial[ currentMaterialSlot ] );
|
|
524
|
+
|
|
525
|
+
} else {
|
|
526
|
+
|
|
527
|
+
editor.removeMaterial( currentMaterial );
|
|
528
|
+
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
editor.execute( new SetMaterialCommand( editor, currentObject, material, currentMaterialSlot ), strings.getKey( 'command/SetMaterial' ) + ': ' + materialClass.getValue() );
|
|
532
|
+
editor.addMaterial( material );
|
|
533
|
+
// TODO Copy other references in the scene graph
|
|
534
|
+
// keeping name and UUID then.
|
|
535
|
+
// Also there should be means to create a unique
|
|
536
|
+
// copy for the current object explicitly and to
|
|
537
|
+
// attach the current material to other objects.
|
|
538
|
+
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
try {
|
|
542
|
+
|
|
543
|
+
const userData = JSON.parse( materialUserData.getValue() );
|
|
544
|
+
if ( JSON.stringify( material.userData ) != JSON.stringify( userData ) ) {
|
|
545
|
+
|
|
546
|
+
editor.execute( new SetMaterialValueCommand( editor, currentObject, 'userData', userData, currentMaterialSlot ) );
|
|
547
|
+
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
} catch ( exception ) {
|
|
551
|
+
|
|
552
|
+
console.warn( exception );
|
|
553
|
+
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
refreshUI();
|
|
557
|
+
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
//
|
|
563
|
+
|
|
564
|
+
function setRowVisibility() {
|
|
565
|
+
|
|
566
|
+
const material = currentObject.material;
|
|
567
|
+
|
|
568
|
+
if ( Array.isArray( material ) ) {
|
|
569
|
+
|
|
570
|
+
materialSlotRow.setDisplay( '' );
|
|
571
|
+
|
|
572
|
+
} else {
|
|
573
|
+
|
|
574
|
+
materialSlotRow.setDisplay( 'none' );
|
|
575
|
+
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function refreshUI() {
|
|
581
|
+
|
|
582
|
+
if ( ! currentObject ) return;
|
|
583
|
+
|
|
584
|
+
let material = currentObject.material;
|
|
585
|
+
|
|
586
|
+
if ( Array.isArray( material ) ) {
|
|
587
|
+
|
|
588
|
+
const slotOptions = {};
|
|
589
|
+
|
|
590
|
+
currentMaterialSlot = Math.max( 0, Math.min( material.length, currentMaterialSlot ) );
|
|
591
|
+
|
|
592
|
+
for ( let i = 0; i < material.length; i ++ ) {
|
|
593
|
+
|
|
594
|
+
slotOptions[ i ] = String( i + 1 ) + ': ' + material[ i ].name;
|
|
595
|
+
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
materialSlotSelect.setOptions( slotOptions ).setValue( currentMaterialSlot );
|
|
599
|
+
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
material = editor.getObjectMaterial( currentObject, currentMaterialSlot );
|
|
603
|
+
|
|
604
|
+
if ( material.uuid !== undefined ) {
|
|
605
|
+
|
|
606
|
+
materialUUID.setValue( material.uuid );
|
|
607
|
+
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if ( material.name !== undefined ) {
|
|
611
|
+
|
|
612
|
+
materialName.setValue( material.name );
|
|
613
|
+
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
if ( currentObject.isMesh ) {
|
|
617
|
+
|
|
618
|
+
materialClass.setOptions( meshMaterialOptions );
|
|
619
|
+
|
|
620
|
+
} else if ( currentObject.isSprite ) {
|
|
621
|
+
|
|
622
|
+
materialClass.setOptions( spriteMaterialOptions );
|
|
623
|
+
|
|
624
|
+
} else if ( currentObject.isPoints ) {
|
|
625
|
+
|
|
626
|
+
materialClass.setOptions( pointsMaterialOptions );
|
|
627
|
+
|
|
628
|
+
} else if ( currentObject.isLine ) {
|
|
629
|
+
|
|
630
|
+
materialClass.setOptions( lineMaterialOptions );
|
|
631
|
+
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
materialClass.setValue( material.type );
|
|
635
|
+
|
|
636
|
+
setRowVisibility();
|
|
637
|
+
|
|
638
|
+
try {
|
|
639
|
+
|
|
640
|
+
materialUserData.setValue( JSON.stringify( material.userData, null, ' ' ) );
|
|
641
|
+
|
|
642
|
+
} catch ( error ) {
|
|
643
|
+
|
|
644
|
+
console.log( error );
|
|
645
|
+
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
materialUserData.setBorderColor( 'transparent' );
|
|
649
|
+
materialUserData.setBackgroundColor( '' );
|
|
650
|
+
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// events
|
|
654
|
+
|
|
655
|
+
signals.objectSelected.add( function ( object ) {
|
|
656
|
+
|
|
657
|
+
let hasMaterial = false;
|
|
658
|
+
|
|
659
|
+
if ( object && object.material ) {
|
|
660
|
+
|
|
661
|
+
hasMaterial = true;
|
|
662
|
+
|
|
663
|
+
if ( Array.isArray( object.material ) && object.material.length === 0 ) {
|
|
664
|
+
|
|
665
|
+
hasMaterial = false;
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
if ( hasMaterial ) {
|
|
672
|
+
|
|
673
|
+
currentObject = object;
|
|
674
|
+
refreshUI();
|
|
675
|
+
container.setDisplay( '' );
|
|
676
|
+
|
|
677
|
+
} else {
|
|
678
|
+
|
|
679
|
+
currentObject = null;
|
|
680
|
+
container.setDisplay( 'none' );
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
} );
|
|
685
|
+
|
|
686
|
+
signals.materialChanged.add( refreshUI );
|
|
687
|
+
|
|
688
|
+
return container;
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const materialClasses = {
|
|
693
|
+
'LineBasicMaterial': THREE.LineBasicMaterial,
|
|
694
|
+
'LineDashedMaterial': THREE.LineDashedMaterial,
|
|
695
|
+
'MeshBasicMaterial': THREE.MeshBasicMaterial,
|
|
696
|
+
'MeshDepthMaterial': THREE.MeshDepthMaterial,
|
|
697
|
+
'MeshNormalMaterial': THREE.MeshNormalMaterial,
|
|
698
|
+
'MeshLambertMaterial': THREE.MeshLambertMaterial,
|
|
699
|
+
'MeshMatcapMaterial': THREE.MeshMatcapMaterial,
|
|
700
|
+
'MeshPhongMaterial': THREE.MeshPhongMaterial,
|
|
701
|
+
'MeshToonMaterial': THREE.MeshToonMaterial,
|
|
702
|
+
'MeshStandardMaterial': THREE.MeshStandardMaterial,
|
|
703
|
+
'MeshPhysicalMaterial': THREE.MeshPhysicalMaterial,
|
|
704
|
+
'RawShaderMaterial': THREE.RawShaderMaterial,
|
|
705
|
+
'ShaderMaterial': THREE.ShaderMaterial,
|
|
706
|
+
'ShadowMaterial': THREE.ShadowMaterial,
|
|
707
|
+
'SpriteMaterial': THREE.SpriteMaterial,
|
|
708
|
+
'PointsMaterial': THREE.PointsMaterial
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
const vertexShaderVariables = [
|
|
712
|
+
'uniform mat4 projectionMatrix;',
|
|
713
|
+
'uniform mat4 modelViewMatrix;\n',
|
|
714
|
+
'attribute vec3 position;\n\n',
|
|
715
|
+
].join( '\n' );
|
|
716
|
+
|
|
717
|
+
const meshMaterialOptions = {
|
|
718
|
+
'MeshBasicMaterial': 'MeshBasicMaterial',
|
|
719
|
+
'MeshDepthMaterial': 'MeshDepthMaterial',
|
|
720
|
+
'MeshNormalMaterial': 'MeshNormalMaterial',
|
|
721
|
+
'MeshLambertMaterial': 'MeshLambertMaterial',
|
|
722
|
+
'MeshMatcapMaterial': 'MeshMatcapMaterial',
|
|
723
|
+
'MeshPhongMaterial': 'MeshPhongMaterial',
|
|
724
|
+
'MeshToonMaterial': 'MeshToonMaterial',
|
|
725
|
+
'MeshStandardMaterial': 'MeshStandardMaterial',
|
|
726
|
+
'MeshPhysicalMaterial': 'MeshPhysicalMaterial',
|
|
727
|
+
'RawShaderMaterial': 'RawShaderMaterial',
|
|
728
|
+
'ShaderMaterial': 'ShaderMaterial',
|
|
729
|
+
'ShadowMaterial': 'ShadowMaterial'
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
const lineMaterialOptions = {
|
|
733
|
+
'LineBasicMaterial': 'LineBasicMaterial',
|
|
734
|
+
'LineDashedMaterial': 'LineDashedMaterial',
|
|
735
|
+
'RawShaderMaterial': 'RawShaderMaterial',
|
|
736
|
+
'ShaderMaterial': 'ShaderMaterial'
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const spriteMaterialOptions = {
|
|
740
|
+
'SpriteMaterial': 'SpriteMaterial',
|
|
741
|
+
'RawShaderMaterial': 'RawShaderMaterial',
|
|
742
|
+
'ShaderMaterial': 'ShaderMaterial'
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
const pointsMaterialOptions = {
|
|
746
|
+
'PointsMaterial': 'PointsMaterial',
|
|
747
|
+
'RawShaderMaterial': 'RawShaderMaterial',
|
|
748
|
+
'ShaderMaterial': 'ShaderMaterial'
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
export { SidebarMaterial };
|