@playcanvas/inspector 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +110 -0
- package/package.json +62 -0
- package/src/asset-usage.js +108 -0
- package/src/asset-view.js +370 -0
- package/src/camera-view.js +128 -0
- package/src/debug.js +31 -0
- package/src/describe.js +302 -0
- package/src/entity-inspector-script.js +130 -0
- package/src/frame-graph-view.js +767 -0
- package/src/hierarchy-view.js +475 -0
- package/src/index.js +4 -0
- package/src/input/fly-controller.js +116 -0
- package/src/input/input.js +299 -0
- package/src/input/math.js +8 -0
- package/src/input/orbit-controller.js +158 -0
- package/src/input/pose.js +207 -0
- package/src/inspector.js +3293 -0
- package/src/instance-survey.js +50 -0
- package/src/list-view.js +410 -0
- package/src/material-view.js +197 -0
- package/src/memory-view.js +344 -0
- package/src/mesh-view.js +235 -0
- package/src/model.js +170 -0
- package/src/node-model.js +404 -0
- package/src/physics-debug.js +527 -0
- package/src/physics-view.js +314 -0
- package/src/picker/picker.js +545 -0
- package/src/picker/render-pass-picker.js +206 -0
- package/src/property-view.js +628 -0
- package/src/render-target-view.js +288 -0
- package/src/renderers/texture-renderer-shaders.js +139 -0
- package/src/renderers/texture-renderer.js +430 -0
- package/src/renderers/wire-renderer.js +954 -0
- package/src/script-view.js +288 -0
- package/src/shader-view.js +287 -0
- package/src/styles.js +918 -0
- package/src/texture-view.js +186 -0
- package/src/tooltip.js +72 -0
- package/src/viewport-tools.js +695 -0
- package/types/asset-usage.d.ts +23 -0
- package/types/asset-view.d.ts +94 -0
- package/types/camera-view.d.ts +45 -0
- package/types/debug.d.ts +14 -0
- package/types/describe.d.ts +43 -0
- package/types/entity-inspector-script.d.ts +87 -0
- package/types/frame-graph-view.d.ts +155 -0
- package/types/hierarchy-view.d.ts +172 -0
- package/types/index.d.ts +3 -0
- package/types/input/fly-controller.d.ts +42 -0
- package/types/input/input.d.ts +192 -0
- package/types/input/math.d.ts +1 -0
- package/types/input/orbit-controller.d.ts +63 -0
- package/types/input/pose.d.ts +126 -0
- package/types/inspector.d.ts +1304 -0
- package/types/instance-survey.d.ts +35 -0
- package/types/list-view.d.ts +151 -0
- package/types/material-view.d.ts +63 -0
- package/types/memory-view.d.ts +95 -0
- package/types/mesh-view.d.ts +89 -0
- package/types/model.d.ts +104 -0
- package/types/node-model.d.ts +54 -0
- package/types/physics-debug.d.ts +254 -0
- package/types/physics-view.d.ts +81 -0
- package/types/picker/picker.d.ts +255 -0
- package/types/picker/render-pass-picker.d.ts +47 -0
- package/types/property-view.d.ts +189 -0
- package/types/render-target-view.d.ts +98 -0
- package/types/renderers/texture-renderer-shaders.d.ts +9 -0
- package/types/renderers/texture-renderer.d.ts +231 -0
- package/types/renderers/wire-renderer.d.ts +347 -0
- package/types/script-view.d.ts +56 -0
- package/types/shader-view.d.ts +46 -0
- package/types/styles.d.ts +22 -0
- package/types/texture-view.d.ts +30 -0
- package/types/tooltip.d.ts +17 -0
- package/types/viewport-tools.d.ts +237 -0
|
@@ -0,0 +1,1304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for {@link Inspector}.
|
|
3
|
+
*/
|
|
4
|
+
export type InspectorOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* - Whether the panel starts shown. Defaults to true.
|
|
7
|
+
*/
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* - The side of the viewport the panel docks to. Defaults to
|
|
11
|
+
* 'right'.
|
|
12
|
+
*/
|
|
13
|
+
dock?: "left" | "right";
|
|
14
|
+
/**
|
|
15
|
+
* - The width of the docked panel in CSS pixels. Defaults to 420.
|
|
16
|
+
*/
|
|
17
|
+
width?: number;
|
|
18
|
+
/**
|
|
19
|
+
* - A gap left above the panel in CSS pixels, to keep it clear of other
|
|
20
|
+
* overlays. Defaults to 0.
|
|
21
|
+
*/
|
|
22
|
+
top?: number;
|
|
23
|
+
/**
|
|
24
|
+
* - The `KeyboardEvent.code` or `key` that shows and hides the
|
|
25
|
+
* panel. Defaults to 'Backquote'. Empty disables the key.
|
|
26
|
+
*/
|
|
27
|
+
toggleKey?: string;
|
|
28
|
+
/**
|
|
29
|
+
* - The key that pauses and resumes the app. Defaults to 'F9'.
|
|
30
|
+
*/
|
|
31
|
+
pauseKey?: string;
|
|
32
|
+
/**
|
|
33
|
+
* - The key that advances one frame while paused. Defaults to 'F10'.
|
|
34
|
+
*/
|
|
35
|
+
stepKey?: string;
|
|
36
|
+
/**
|
|
37
|
+
* - A node whose enabled checkbox, and those of its
|
|
38
|
+
* ancestors, are withheld. A script hosting the inspector passes its own entity so the panel
|
|
39
|
+
* cannot switch itself off. Defaults to null.
|
|
40
|
+
*/
|
|
41
|
+
lockedNode?: GraphNode | null;
|
|
42
|
+
/**
|
|
43
|
+
* - Called with the new visibility
|
|
44
|
+
* whenever the panel is shown or hidden, whether through {@link Inspector#visible}, the toggle key
|
|
45
|
+
* or the panel's own close button.
|
|
46
|
+
*/
|
|
47
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
48
|
+
/**
|
|
49
|
+
* - The local storage key the panel's settings are kept
|
|
50
|
+
* under, so they survive a reload or a restart of the app: the physics drawing switch and options,
|
|
51
|
+
* the bodies excluded from it (by entity path), the active tab, the panel width and the GPU
|
|
52
|
+
* timings switch. Stored settings take precedence over the defaults given here. Defaults to
|
|
53
|
+
* 'pc-inspector'; null keeps nothing.
|
|
54
|
+
*/
|
|
55
|
+
storageKey?: string | null;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Which parts of the physics world the Physics tab draws. Each option is a checkbox on the tab.
|
|
59
|
+
*/
|
|
60
|
+
export type InspectorPhysicsDrawOptions = {
|
|
61
|
+
/**
|
|
62
|
+
* - Collision shapes, colored by activation state. Defaults to
|
|
63
|
+
* true.
|
|
64
|
+
*/
|
|
65
|
+
wireframe?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* - Axis-aligned bounds of each body.
|
|
68
|
+
*/
|
|
69
|
+
aabb?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* - Contact points and normals from the last step.
|
|
72
|
+
*/
|
|
73
|
+
contacts?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* - Joint frames.
|
|
76
|
+
*/
|
|
77
|
+
constraints?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* - Joint limits.
|
|
80
|
+
*/
|
|
81
|
+
limits?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* - Face normals of mesh shapes.
|
|
84
|
+
*/
|
|
85
|
+
normals?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* - Local axes of each body.
|
|
88
|
+
*/
|
|
89
|
+
frames?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* - Stop bodies from falling asleep while drawing.
|
|
92
|
+
*/
|
|
93
|
+
keepAwake?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* - Hide lines behind geometry.
|
|
96
|
+
*/
|
|
97
|
+
depthTest?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* - Only draw lines within this distance of the camera, in meters. Zero
|
|
100
|
+
* draws everything.
|
|
101
|
+
*/
|
|
102
|
+
range?: number;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* An in-page inspector for a running application. It docks a panel over the canvas with four
|
|
106
|
+
* tabs above a live property view of whatever is selected:
|
|
107
|
+
*
|
|
108
|
+
* - Hierarchy: the entity tree. The property view shows the node's transform, every component it
|
|
109
|
+
* carries and every script instance with its attributes. The selected node is outlined in the
|
|
110
|
+
* viewport.
|
|
111
|
+
* - Cameras: every camera in render order, with its target, viewport, layers and render mode. The
|
|
112
|
+
* render mode of a camera can be switched to a debug view of the material inputs, the whole scene
|
|
113
|
+
* drawn in wireframe, and any camera flown.
|
|
114
|
+
* - Frame graph: the render passes of the last frame in execution order, as the render pass trace
|
|
115
|
+
* prints them, with the layer steps of forward passes, the light of shadow passes and optional
|
|
116
|
+
* GPU timings. Render target cells link to the next tab.
|
|
117
|
+
* - Render targets: every render target on the device including the backbuffer, with its
|
|
118
|
+
* attachments and the passes that rendered into it this frame, linking back to the frame graph.
|
|
119
|
+
* The selected target's attachment can be previewed live in a corner of the viewport.
|
|
120
|
+
* - Textures: every texture on the device, largest GPU footprint first, with the same live preview.
|
|
121
|
+
* Texture values elsewhere, such as the maps of a material, link here.
|
|
122
|
+
* - Meshes: every mesh found through the components, layers and assets using it, largest first,
|
|
123
|
+
* with its geometry and users. Nothing keeps a list of meshes, so a note counts the vertex buffers
|
|
124
|
+
* on the device that belong to no mesh found. Mesh values elsewhere link here.
|
|
125
|
+
* - Materials: every material found through the mesh instances and assets using it, most used
|
|
126
|
+
* first, with its textures, compiled variants and users. Material values elsewhere link here, and
|
|
127
|
+
* the Textures and Shaders tabs list the materials using a texture or shader.
|
|
128
|
+
* - Scripts: every script class the script registry holds or an entity uses, with the entities using
|
|
129
|
+
* it, its declared attributes and its source as the browser keeps it. The script sections of an
|
|
130
|
+
* entity link here.
|
|
131
|
+
* - Memory: video memory by kind of resource, and every buffer on the device, largest first, named
|
|
132
|
+
* after the mesh, material or asset it was found to belong to. Buffer values elsewhere link here.
|
|
133
|
+
* - Shaders: every shader on the device with its language, state and vertex attributes. The
|
|
134
|
+
* compiled variants listed on a material link here.
|
|
135
|
+
* - Assets: every asset in the registry with its file, load state and the components using it.
|
|
136
|
+
* Asset references on a component link here, and a texture names the asset it came from.
|
|
137
|
+
* - Physics: the rigid bodies and joints of the scene, with the physics world drawn over the scene
|
|
138
|
+
* through the engine's debug drawer when Ammo is loaded.
|
|
139
|
+
*
|
|
140
|
+
* The app can be paused and stepped a frame at a time, and the panel can be popped out into its own
|
|
141
|
+
* window to leave the canvas unobscured.
|
|
142
|
+
*
|
|
143
|
+
* The view is read-only, with one exception: the checkbox on each hierarchy row flips the node's
|
|
144
|
+
* enabled flag.
|
|
145
|
+
*
|
|
146
|
+
* ```javascript
|
|
147
|
+
* const inspector = new Inspector(app, { dock: 'left' });
|
|
148
|
+
* inspector.visible = false; // show again with the backquote key
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* Default keys: backquote toggles the panel, F9 pauses and resumes, F10 steps one frame while
|
|
152
|
+
* paused. Pausing sets {@link AppBase#timeScale} to zero and suspends the sound manager, so
|
|
153
|
+
* rendering continues while every time-driven system stands still. Scripts that read the wall
|
|
154
|
+
* clock rather than the frame delta keep moving.
|
|
155
|
+
*
|
|
156
|
+
* The property view is generic: it reflects on the public getters of each component and script,
|
|
157
|
+
* so components it has never heard of show up with all of their state.
|
|
158
|
+
*
|
|
159
|
+
* @category Debug
|
|
160
|
+
*/
|
|
161
|
+
export class Inspector {
|
|
162
|
+
/**
|
|
163
|
+
* @returns {Storage|null} The window's local storage, or null where there is none or reading
|
|
164
|
+
* it throws, as in some sandboxed frames.
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
private static _storage;
|
|
168
|
+
/**
|
|
169
|
+
* @param {HTMLElement} element - A note element.
|
|
170
|
+
* @param {string} text - The text, empty to hide the note.
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
173
|
+
private static _setNote;
|
|
174
|
+
/**
|
|
175
|
+
* @param {string} key - A `KeyboardEvent.code` or `key`.
|
|
176
|
+
* @returns {string} The key as shown on a button, or an empty string when unset.
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
private static _keyLabel;
|
|
180
|
+
/**
|
|
181
|
+
* @param {string} key - A `KeyboardEvent.code` or `key`.
|
|
182
|
+
* @returns {string} The key in brackets for a button label, or an empty string when unset.
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
private static _keyHint;
|
|
186
|
+
/**
|
|
187
|
+
* Creates the inspector and shows its panel. The panel is appended to the document body and
|
|
188
|
+
* follows the app until {@link destroy} is called, or the app is destroyed.
|
|
189
|
+
*
|
|
190
|
+
* @param {AppBase} app - The app to inspect.
|
|
191
|
+
* @param {InspectorOptions} [options] - The options.
|
|
192
|
+
* @example
|
|
193
|
+
* const inspector = new Inspector(app, { dock: 'left', width: 480 });
|
|
194
|
+
*/
|
|
195
|
+
constructor(app: Asset, options?: InspectorOptions);
|
|
196
|
+
/**
|
|
197
|
+
* Called with the new visibility whenever the panel is shown or hidden, whether through
|
|
198
|
+
* {@link visible}, the toggle key or the panel's own close button. Set from the
|
|
199
|
+
* {@link InspectorOptions#onVisibleChange} option, or assigned later.
|
|
200
|
+
*
|
|
201
|
+
* @type {((visible: boolean) => void)|null}
|
|
202
|
+
*/
|
|
203
|
+
onVisibleChange: ((visible: boolean) => void) | null;
|
|
204
|
+
/**
|
|
205
|
+
* @type {AppBase}
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
private _app;
|
|
209
|
+
/** @private */
|
|
210
|
+
private _toggleKey;
|
|
211
|
+
/** @private */
|
|
212
|
+
private _pauseKey;
|
|
213
|
+
/** @private */
|
|
214
|
+
private _stepKey;
|
|
215
|
+
/**
|
|
216
|
+
* @type {Color}
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
private _highlightColor;
|
|
220
|
+
/**
|
|
221
|
+
* @type {GraphNode|null}
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
private _lockedNode;
|
|
225
|
+
/** @private */
|
|
226
|
+
private _visible;
|
|
227
|
+
/** @private */
|
|
228
|
+
private _dock;
|
|
229
|
+
/** @private */
|
|
230
|
+
private _width;
|
|
231
|
+
/** @private */
|
|
232
|
+
private _top;
|
|
233
|
+
/** @private */
|
|
234
|
+
private _paused;
|
|
235
|
+
/** @private */
|
|
236
|
+
private _savedTimeScale;
|
|
237
|
+
/** @private */
|
|
238
|
+
private _destroyed;
|
|
239
|
+
/**
|
|
240
|
+
* @type {Window|null}
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
private _popup;
|
|
244
|
+
/**
|
|
245
|
+
* @type {GraphNode|null}
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
private _selected;
|
|
249
|
+
/**
|
|
250
|
+
* @type {HTMLElement|null}
|
|
251
|
+
* @private
|
|
252
|
+
*/
|
|
253
|
+
private _host;
|
|
254
|
+
/**
|
|
255
|
+
* @type {HTMLElement}
|
|
256
|
+
* @private
|
|
257
|
+
*/
|
|
258
|
+
private _panel;
|
|
259
|
+
/**
|
|
260
|
+
* @type {HTMLElement}
|
|
261
|
+
* @private
|
|
262
|
+
*/
|
|
263
|
+
private _hierarchyEl;
|
|
264
|
+
/**
|
|
265
|
+
* @type {HTMLInputElement}
|
|
266
|
+
* @private
|
|
267
|
+
*/
|
|
268
|
+
private _filterInput;
|
|
269
|
+
/**
|
|
270
|
+
* What the hierarchy filter matches: entity names, component types or script names.
|
|
271
|
+
*
|
|
272
|
+
* @type {HTMLSelectElement}
|
|
273
|
+
* @private
|
|
274
|
+
*/
|
|
275
|
+
private _filterBy;
|
|
276
|
+
/**
|
|
277
|
+
* The values offered while filtering the hierarchy by component or script.
|
|
278
|
+
*
|
|
279
|
+
* @type {HTMLDataListElement}
|
|
280
|
+
* @private
|
|
281
|
+
*/
|
|
282
|
+
private _filterSuggestions;
|
|
283
|
+
/**
|
|
284
|
+
* @type {HTMLButtonElement}
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
private _pauseBtn;
|
|
288
|
+
/**
|
|
289
|
+
* @type {HTMLButtonElement}
|
|
290
|
+
* @private
|
|
291
|
+
*/
|
|
292
|
+
private _stepBtn;
|
|
293
|
+
/**
|
|
294
|
+
* @type {HTMLButtonElement}
|
|
295
|
+
* @private
|
|
296
|
+
*/
|
|
297
|
+
private _popBtn;
|
|
298
|
+
/**
|
|
299
|
+
* @type {HTMLElement}
|
|
300
|
+
* @private
|
|
301
|
+
*/
|
|
302
|
+
private _countsEl;
|
|
303
|
+
/**
|
|
304
|
+
* @type {HTMLElement}
|
|
305
|
+
* @private
|
|
306
|
+
*/
|
|
307
|
+
private _pausedEl;
|
|
308
|
+
/**
|
|
309
|
+
* @type {HTMLElement}
|
|
310
|
+
* @private
|
|
311
|
+
*/
|
|
312
|
+
private _pathEl;
|
|
313
|
+
/**
|
|
314
|
+
* What the view is doing while it is picked, flown or orbited.
|
|
315
|
+
*
|
|
316
|
+
* @type {HTMLElement}
|
|
317
|
+
* @private
|
|
318
|
+
*/
|
|
319
|
+
private _modeEl;
|
|
320
|
+
/**
|
|
321
|
+
* @type {HierarchyView}
|
|
322
|
+
* @private
|
|
323
|
+
*/
|
|
324
|
+
private _hierarchy;
|
|
325
|
+
/**
|
|
326
|
+
* @type {PropertyView}
|
|
327
|
+
* @private
|
|
328
|
+
*/
|
|
329
|
+
private _properties;
|
|
330
|
+
/**
|
|
331
|
+
* @type {WireRenderer}
|
|
332
|
+
* @private
|
|
333
|
+
*/
|
|
334
|
+
private _wire;
|
|
335
|
+
/** @private */
|
|
336
|
+
private _nextListRefresh;
|
|
337
|
+
/** @private */
|
|
338
|
+
private _nextPropertyRefresh;
|
|
339
|
+
/**
|
|
340
|
+
* @type {'hierarchy'|'cameras'|'assets'|'passes'|'targets'|'textures'|'meshes'|'materials'|'scripts'|'memory'|'shaders'|'physics'}
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
private _tab;
|
|
344
|
+
/**
|
|
345
|
+
* @type {FrameSnapshot|null}
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
private _frame;
|
|
349
|
+
/** @private */
|
|
350
|
+
private _frozen;
|
|
351
|
+
/** @private */
|
|
352
|
+
private _gpuWasEnabled;
|
|
353
|
+
/**
|
|
354
|
+
* @type {Record<string, HTMLElement>}
|
|
355
|
+
* @private
|
|
356
|
+
*/
|
|
357
|
+
private _tabButtons;
|
|
358
|
+
/**
|
|
359
|
+
* @type {Record<string, HTMLElement>}
|
|
360
|
+
* @private
|
|
361
|
+
*/
|
|
362
|
+
private _panels;
|
|
363
|
+
/**
|
|
364
|
+
* @type {ListView}
|
|
365
|
+
* @private
|
|
366
|
+
*/
|
|
367
|
+
private _passList;
|
|
368
|
+
/**
|
|
369
|
+
* @type {ListView}
|
|
370
|
+
* @private
|
|
371
|
+
*/
|
|
372
|
+
private _targetList;
|
|
373
|
+
/**
|
|
374
|
+
* @type {ListView}
|
|
375
|
+
* @private
|
|
376
|
+
*/
|
|
377
|
+
private _bodyList;
|
|
378
|
+
/**
|
|
379
|
+
* Draws the selected render target's texture over the canvas, straight from the GPU.
|
|
380
|
+
*
|
|
381
|
+
* @type {TextureRenderer}
|
|
382
|
+
* @private
|
|
383
|
+
*/
|
|
384
|
+
private _textures;
|
|
385
|
+
/**
|
|
386
|
+
* @type {HTMLInputElement}
|
|
387
|
+
* @private
|
|
388
|
+
*/
|
|
389
|
+
private _previewToggle;
|
|
390
|
+
/**
|
|
391
|
+
* @type {HTMLSelectElement}
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
private _previewAttachment;
|
|
395
|
+
/**
|
|
396
|
+
* @type {HTMLSelectElement}
|
|
397
|
+
* @private
|
|
398
|
+
*/
|
|
399
|
+
private _previewChannels;
|
|
400
|
+
/**
|
|
401
|
+
* @type {HTMLElement}
|
|
402
|
+
* @private
|
|
403
|
+
*/
|
|
404
|
+
private _previewNote;
|
|
405
|
+
/**
|
|
406
|
+
* The attachment keys the selector currently offers, to rebuild it only when they change.
|
|
407
|
+
*
|
|
408
|
+
* @private
|
|
409
|
+
*/
|
|
410
|
+
private _previewKeys;
|
|
411
|
+
/**
|
|
412
|
+
* @type {ListView}
|
|
413
|
+
* @private
|
|
414
|
+
*/
|
|
415
|
+
private _textureList;
|
|
416
|
+
/**
|
|
417
|
+
* @type {ListView}
|
|
418
|
+
* @private
|
|
419
|
+
*/
|
|
420
|
+
private _shaderList;
|
|
421
|
+
/**
|
|
422
|
+
* @type {ListView}
|
|
423
|
+
* @private
|
|
424
|
+
*/
|
|
425
|
+
private _assetList;
|
|
426
|
+
/**
|
|
427
|
+
* @type {ListView}
|
|
428
|
+
* @private
|
|
429
|
+
*/
|
|
430
|
+
private _bufferList;
|
|
431
|
+
/**
|
|
432
|
+
* @type {ListView}
|
|
433
|
+
* @private
|
|
434
|
+
*/
|
|
435
|
+
private _meshList;
|
|
436
|
+
/**
|
|
437
|
+
* @type {HTMLElement}
|
|
438
|
+
* @private
|
|
439
|
+
*/
|
|
440
|
+
private _meshNote;
|
|
441
|
+
/**
|
|
442
|
+
* @type {ListView}
|
|
443
|
+
* @private
|
|
444
|
+
*/
|
|
445
|
+
private _materialList;
|
|
446
|
+
/**
|
|
447
|
+
* @type {ListView}
|
|
448
|
+
* @private
|
|
449
|
+
*/
|
|
450
|
+
private _scriptList;
|
|
451
|
+
/**
|
|
452
|
+
* @type {ListView}
|
|
453
|
+
* @private
|
|
454
|
+
*/
|
|
455
|
+
private _cameraList;
|
|
456
|
+
/**
|
|
457
|
+
* The render mode applied from the Cameras tab.
|
|
458
|
+
*
|
|
459
|
+
* @type {HTMLSelectElement}
|
|
460
|
+
* @private
|
|
461
|
+
*/
|
|
462
|
+
private _renderMode;
|
|
463
|
+
/**
|
|
464
|
+
* Whether the render mode applies to the selected camera or to all of them.
|
|
465
|
+
*
|
|
466
|
+
* @type {HTMLSelectElement}
|
|
467
|
+
* @private
|
|
468
|
+
*/
|
|
469
|
+
private _renderScope;
|
|
470
|
+
/**
|
|
471
|
+
* The cameras last listed in the render mode scope, to rebuild it only when they change.
|
|
472
|
+
*
|
|
473
|
+
* @type {string}
|
|
474
|
+
* @private
|
|
475
|
+
*/
|
|
476
|
+
private _scopeSignature;
|
|
477
|
+
/**
|
|
478
|
+
* @type {HTMLInputElement}
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
private _wireframeToggle;
|
|
482
|
+
/**
|
|
483
|
+
* Ends the render mode changes and wireframe.
|
|
484
|
+
*
|
|
485
|
+
* @type {HTMLButtonElement}
|
|
486
|
+
* @private
|
|
487
|
+
*/
|
|
488
|
+
private _resetViewBtn;
|
|
489
|
+
/**
|
|
490
|
+
* The shader pass each camera the panel changed had before, to put back.
|
|
491
|
+
*
|
|
492
|
+
* @type {Map<CameraComponent, string|null>}
|
|
493
|
+
* @private
|
|
494
|
+
*/
|
|
495
|
+
private _changedPasses;
|
|
496
|
+
/** @private */
|
|
497
|
+
private _wireframe;
|
|
498
|
+
/**
|
|
499
|
+
* @type {ViewportPicker|null}
|
|
500
|
+
* @private
|
|
501
|
+
*/
|
|
502
|
+
private _picker;
|
|
503
|
+
/**
|
|
504
|
+
* The pointer events taken while picking, or while waiting for a click choosing the camera to
|
|
505
|
+
* fly, null otherwise.
|
|
506
|
+
*
|
|
507
|
+
* @type {CanvasCapture|null}
|
|
508
|
+
* @private
|
|
509
|
+
*/
|
|
510
|
+
private _canvasCapture;
|
|
511
|
+
/**
|
|
512
|
+
* What the canvas capture is for.
|
|
513
|
+
*
|
|
514
|
+
* @type {'pick'|'choose'|null}
|
|
515
|
+
* @private
|
|
516
|
+
*/
|
|
517
|
+
private _canvasMode;
|
|
518
|
+
/**
|
|
519
|
+
* The entity under the pointer while picking.
|
|
520
|
+
*
|
|
521
|
+
* @type {Entity|null}
|
|
522
|
+
* @private
|
|
523
|
+
*/
|
|
524
|
+
private _hovered;
|
|
525
|
+
/**
|
|
526
|
+
* The camera driven by Fly or Orbit, while one is.
|
|
527
|
+
*
|
|
528
|
+
* @type {CameraFly|CameraOrbit|null}
|
|
529
|
+
* @private
|
|
530
|
+
*/
|
|
531
|
+
private _fly;
|
|
532
|
+
/**
|
|
533
|
+
* Which of Fly and Orbit waits for the view of a camera to be clicked, while one does.
|
|
534
|
+
*
|
|
535
|
+
* @type {'fly'|'orbit'}
|
|
536
|
+
* @private
|
|
537
|
+
*/
|
|
538
|
+
private _chooseKind;
|
|
539
|
+
/**
|
|
540
|
+
* @type {HTMLButtonElement}
|
|
541
|
+
* @private
|
|
542
|
+
*/
|
|
543
|
+
private _pickBtn;
|
|
544
|
+
/**
|
|
545
|
+
* @type {HTMLButtonElement}
|
|
546
|
+
* @private
|
|
547
|
+
*/
|
|
548
|
+
private _flyBtn;
|
|
549
|
+
/**
|
|
550
|
+
* @type {HTMLButtonElement}
|
|
551
|
+
* @private
|
|
552
|
+
*/
|
|
553
|
+
private _orbitBtn;
|
|
554
|
+
/** @private */
|
|
555
|
+
private _hoverColor;
|
|
556
|
+
/**
|
|
557
|
+
* The latest pointer position to pick under while hovering, null once it has been picked.
|
|
558
|
+
*
|
|
559
|
+
* @type {number[]|null}
|
|
560
|
+
* @private
|
|
561
|
+
*/
|
|
562
|
+
private _hoverPoint;
|
|
563
|
+
/**
|
|
564
|
+
* @type {HTMLInputElement}
|
|
565
|
+
* @private
|
|
566
|
+
*/
|
|
567
|
+
private _passPreviewToggle;
|
|
568
|
+
/**
|
|
569
|
+
* @type {HTMLInputElement}
|
|
570
|
+
* @private
|
|
571
|
+
*/
|
|
572
|
+
private _debugFrameToggle;
|
|
573
|
+
/**
|
|
574
|
+
* @type {HTMLElement}
|
|
575
|
+
* @private
|
|
576
|
+
*/
|
|
577
|
+
private _passNote;
|
|
578
|
+
/**
|
|
579
|
+
* @type {HTMLElement}
|
|
580
|
+
* @private
|
|
581
|
+
*/
|
|
582
|
+
private _debugEl;
|
|
583
|
+
/**
|
|
584
|
+
* The debug frame while it is on: the layer step it stops in, by its list key, the draw it stops
|
|
585
|
+
* at within that step's list, and the instance drawn last, which keeps the choice when the sort
|
|
586
|
+
* order shifts. Null while it is off.
|
|
587
|
+
*
|
|
588
|
+
* @type {{ stepKey: string|null, index: number, instance: MeshInstance|null, wasPaused: boolean }|null}
|
|
589
|
+
* @private
|
|
590
|
+
*/
|
|
591
|
+
private _debugFrame;
|
|
592
|
+
/**
|
|
593
|
+
* The link or row the pointer is over, with a function reading its current target, so a texture
|
|
594
|
+
* or render target can preview while hovered.
|
|
595
|
+
*
|
|
596
|
+
* @type {{ el: HTMLElement, target: () => * }|null}
|
|
597
|
+
* @private
|
|
598
|
+
*/
|
|
599
|
+
private _hoverLink;
|
|
600
|
+
/**
|
|
601
|
+
* The page each forward pass layer step shows, by pass row key and step, kept across refreshes.
|
|
602
|
+
*
|
|
603
|
+
* @type {Map<string, number>}
|
|
604
|
+
* @private
|
|
605
|
+
*/
|
|
606
|
+
private _instancePages;
|
|
607
|
+
/**
|
|
608
|
+
* @type {HTMLSelectElement}
|
|
609
|
+
* @private
|
|
610
|
+
*/
|
|
611
|
+
private _bufferKind;
|
|
612
|
+
/**
|
|
613
|
+
* @type {HTMLElement}
|
|
614
|
+
* @private
|
|
615
|
+
*/
|
|
616
|
+
private _memoryNote;
|
|
617
|
+
/**
|
|
618
|
+
* Model builder for the property view when a buffer is selected.
|
|
619
|
+
*
|
|
620
|
+
* @param {*} buffer - The buffer.
|
|
621
|
+
* @returns {PropertySection[]} The sections.
|
|
622
|
+
* @private
|
|
623
|
+
*/
|
|
624
|
+
private _bufferModel;
|
|
625
|
+
/**
|
|
626
|
+
* Model builder for the property view when a mesh is selected.
|
|
627
|
+
*
|
|
628
|
+
* @param {Mesh} mesh - The mesh.
|
|
629
|
+
* @returns {PropertySection[]} The sections.
|
|
630
|
+
* @private
|
|
631
|
+
*/
|
|
632
|
+
private _meshModel;
|
|
633
|
+
/**
|
|
634
|
+
* Model builder for the property view when a material is selected.
|
|
635
|
+
*
|
|
636
|
+
* @param {Material} material - The material.
|
|
637
|
+
* @returns {PropertySection[]} The sections.
|
|
638
|
+
* @private
|
|
639
|
+
*/
|
|
640
|
+
private _materialModel;
|
|
641
|
+
/**
|
|
642
|
+
* Model builder for the property view when a camera is selected.
|
|
643
|
+
*
|
|
644
|
+
* @param {CameraComponent} camera - The camera.
|
|
645
|
+
* @returns {PropertySection[]} The sections.
|
|
646
|
+
* @private
|
|
647
|
+
*/
|
|
648
|
+
private _cameraModel;
|
|
649
|
+
/**
|
|
650
|
+
* Model builder for the property view when a script class is selected.
|
|
651
|
+
*
|
|
652
|
+
* @param {Function} cls - The script class.
|
|
653
|
+
* @returns {PropertySection[]} The sections.
|
|
654
|
+
* @private
|
|
655
|
+
*/
|
|
656
|
+
private _scriptModel;
|
|
657
|
+
/**
|
|
658
|
+
* Model builder for the property view when a shader is selected, followed by the materials that
|
|
659
|
+
* compiled it.
|
|
660
|
+
*
|
|
661
|
+
* @param {Shader} shader - The shader.
|
|
662
|
+
* @returns {PropertySection[]} The sections.
|
|
663
|
+
* @private
|
|
664
|
+
*/
|
|
665
|
+
private _shaderModel;
|
|
666
|
+
/**
|
|
667
|
+
* @type {HTMLSelectElement}
|
|
668
|
+
* @private
|
|
669
|
+
*/
|
|
670
|
+
private _assetSort;
|
|
671
|
+
/**
|
|
672
|
+
* Model builder for the property view when an asset is selected, with what uses its resource
|
|
673
|
+
* directly added to the components referencing it.
|
|
674
|
+
*
|
|
675
|
+
* @param {Asset} asset - The asset.
|
|
676
|
+
* @returns {PropertySection[]} The sections.
|
|
677
|
+
* @private
|
|
678
|
+
*/
|
|
679
|
+
private _assetModel;
|
|
680
|
+
/**
|
|
681
|
+
* @type {HTMLInputElement}
|
|
682
|
+
* @private
|
|
683
|
+
*/
|
|
684
|
+
private _texturePreviewToggle;
|
|
685
|
+
/**
|
|
686
|
+
* @type {HTMLSelectElement}
|
|
687
|
+
* @private
|
|
688
|
+
*/
|
|
689
|
+
private _textureChannels;
|
|
690
|
+
/**
|
|
691
|
+
* @type {HTMLElement}
|
|
692
|
+
* @private
|
|
693
|
+
*/
|
|
694
|
+
private _textureNote;
|
|
695
|
+
/**
|
|
696
|
+
* Model builder for the property view when a texture is selected, followed by the materials
|
|
697
|
+
* sampling it.
|
|
698
|
+
*
|
|
699
|
+
* @param {Texture} texture - The texture.
|
|
700
|
+
* @returns {PropertySection[]} The sections.
|
|
701
|
+
* @private
|
|
702
|
+
*/
|
|
703
|
+
private _textureModel;
|
|
704
|
+
/**
|
|
705
|
+
* @type {HTMLInputElement}
|
|
706
|
+
* @private
|
|
707
|
+
*/
|
|
708
|
+
private _gpuToggle;
|
|
709
|
+
/**
|
|
710
|
+
* @type {HTMLInputElement}
|
|
711
|
+
* @private
|
|
712
|
+
*/
|
|
713
|
+
private _freezeToggle;
|
|
714
|
+
/**
|
|
715
|
+
* @type {AmmoDebugDraw|null}
|
|
716
|
+
* @private
|
|
717
|
+
*/
|
|
718
|
+
private _physics;
|
|
719
|
+
/**
|
|
720
|
+
* @type {HTMLInputElement}
|
|
721
|
+
* @private
|
|
722
|
+
*/
|
|
723
|
+
private _drawToggle;
|
|
724
|
+
/**
|
|
725
|
+
* @type {HTMLInputElement}
|
|
726
|
+
* @private
|
|
727
|
+
*/
|
|
728
|
+
private _depthToggle;
|
|
729
|
+
/**
|
|
730
|
+
* @type {HTMLInputElement}
|
|
731
|
+
* @private
|
|
732
|
+
*/
|
|
733
|
+
private _rangeInput;
|
|
734
|
+
/**
|
|
735
|
+
* The checkbox of each boolean physics draw option, by option name.
|
|
736
|
+
*
|
|
737
|
+
* @type {Record<string, HTMLInputElement>}
|
|
738
|
+
* @private
|
|
739
|
+
*/
|
|
740
|
+
private _physicsToggles;
|
|
741
|
+
/**
|
|
742
|
+
* @type {HTMLElement}
|
|
743
|
+
* @private
|
|
744
|
+
*/
|
|
745
|
+
private _physicsNote;
|
|
746
|
+
/**
|
|
747
|
+
* The bar holding the options governed by the Draw switch.
|
|
748
|
+
*
|
|
749
|
+
* @type {HTMLElement}
|
|
750
|
+
* @private
|
|
751
|
+
*/
|
|
752
|
+
private _physicsOptionsBar;
|
|
753
|
+
/**
|
|
754
|
+
* Bodies excluded from the physics drawing, with the native body the exclusion was applied to,
|
|
755
|
+
* or null while the entity has no native body yet.
|
|
756
|
+
*
|
|
757
|
+
* @type {Map<Entity, any>}
|
|
758
|
+
* @private
|
|
759
|
+
*/
|
|
760
|
+
private _hiddenBodies;
|
|
761
|
+
/**
|
|
762
|
+
* Entity paths of excluded bodies restored from storage, waiting for the entities to exist.
|
|
763
|
+
*
|
|
764
|
+
* @type {Set<string>}
|
|
765
|
+
* @private
|
|
766
|
+
*/
|
|
767
|
+
private _pendingHiddenPaths;
|
|
768
|
+
/**
|
|
769
|
+
* @type {string|null}
|
|
770
|
+
* @private
|
|
771
|
+
*/
|
|
772
|
+
private _storageKey;
|
|
773
|
+
/**
|
|
774
|
+
* True while the panel is being built and restored, when nothing should be saved.
|
|
775
|
+
*
|
|
776
|
+
* @private
|
|
777
|
+
*/
|
|
778
|
+
private _restoring;
|
|
779
|
+
/**
|
|
780
|
+
* Model builder for the property view when a pass is selected.
|
|
781
|
+
*
|
|
782
|
+
* @param {FramePass} pass - The pass.
|
|
783
|
+
* @returns {PropertySection[]} The sections.
|
|
784
|
+
* @private
|
|
785
|
+
*/
|
|
786
|
+
private _passModel;
|
|
787
|
+
/**
|
|
788
|
+
* Model builder for the property view when a layer step of a forward pass is selected.
|
|
789
|
+
*
|
|
790
|
+
* @param {LayerStepSelection} selection - The step and its pass.
|
|
791
|
+
* @returns {PropertySection[]} The sections.
|
|
792
|
+
* @private
|
|
793
|
+
*/
|
|
794
|
+
private _stepModel;
|
|
795
|
+
/**
|
|
796
|
+
* @param {*} item - What a row of the pass list selects: a pass, or one of its layer steps.
|
|
797
|
+
* @returns {(subject: *) => PropertySection[]} The model builder that shows it.
|
|
798
|
+
* @private
|
|
799
|
+
*/
|
|
800
|
+
private _passListModel;
|
|
801
|
+
/**
|
|
802
|
+
* Model builder for the property view when a render target is selected.
|
|
803
|
+
*
|
|
804
|
+
* @param {RenderTarget} rt - The render target.
|
|
805
|
+
* @returns {PropertySection[]} The sections.
|
|
806
|
+
* @private
|
|
807
|
+
*/
|
|
808
|
+
private _targetModel;
|
|
809
|
+
/**
|
|
810
|
+
* Which parts of the physics world are drawn, mirroring the checkboxes of the Physics tab.
|
|
811
|
+
* Assigning a partial object changes only the options it names.
|
|
812
|
+
*
|
|
813
|
+
* @type {InspectorPhysicsDrawOptions}
|
|
814
|
+
* @private
|
|
815
|
+
*/
|
|
816
|
+
private set _physicsDrawOptions(value);
|
|
817
|
+
/**
|
|
818
|
+
* @returns {InspectorPhysicsDrawOptions} Which parts of the physics world are drawn.
|
|
819
|
+
* @private
|
|
820
|
+
*/
|
|
821
|
+
private get _physicsDrawOptions();
|
|
822
|
+
/**
|
|
823
|
+
* Whether the physics world is drawn over the scene while the panel is shown: the Draw checkbox
|
|
824
|
+
* of the Physics tab. Hiding the panel suspends the drawing; showing it again resumes it.
|
|
825
|
+
*
|
|
826
|
+
* @type {boolean}
|
|
827
|
+
* @private
|
|
828
|
+
*/
|
|
829
|
+
private set _physicsDraw(value);
|
|
830
|
+
/**
|
|
831
|
+
* @returns {boolean} Whether the physics world is drawn.
|
|
832
|
+
* @private
|
|
833
|
+
*/
|
|
834
|
+
private get _physicsDraw();
|
|
835
|
+
/**
|
|
836
|
+
* Removes the panel, releases every hook into the app and restores anything the inspector
|
|
837
|
+
* changed: the time scale while paused, the GPU profiler, the physics debug drawer.
|
|
838
|
+
*/
|
|
839
|
+
destroy(): void;
|
|
840
|
+
/**
|
|
841
|
+
* Whether the app is paused. Pausing sets {@link AppBase#timeScale} to zero and suspends the
|
|
842
|
+
* sound manager; resuming restores the time scale that was in effect.
|
|
843
|
+
*
|
|
844
|
+
* @type {boolean}
|
|
845
|
+
*/
|
|
846
|
+
set paused(value: boolean);
|
|
847
|
+
get paused(): boolean;
|
|
848
|
+
/**
|
|
849
|
+
* Whether the panel is shown. Toggled by the toggle key.
|
|
850
|
+
*
|
|
851
|
+
* @type {boolean}
|
|
852
|
+
*/
|
|
853
|
+
set visible(value: boolean);
|
|
854
|
+
get visible(): boolean;
|
|
855
|
+
/**
|
|
856
|
+
* Advances the app by one frame. Only meaningful while paused.
|
|
857
|
+
*/
|
|
858
|
+
step(): void;
|
|
859
|
+
/**
|
|
860
|
+
* Refreshes the active list and the property view immediately.
|
|
861
|
+
*
|
|
862
|
+
* @private
|
|
863
|
+
*/
|
|
864
|
+
private _refresh;
|
|
865
|
+
/**
|
|
866
|
+
* Moves the panel into its own browser window, leaving the canvas unobscured. Must be called
|
|
867
|
+
* from a user gesture, or the browser blocks the window.
|
|
868
|
+
*
|
|
869
|
+
* @private
|
|
870
|
+
*/
|
|
871
|
+
private _popOut;
|
|
872
|
+
/**
|
|
873
|
+
* Brings a popped-out panel back into the page and closes its window.
|
|
874
|
+
*
|
|
875
|
+
* @private
|
|
876
|
+
*/
|
|
877
|
+
private _dockBack;
|
|
878
|
+
/**
|
|
879
|
+
* @param {number} dt - The frame delta, scaled by the app time scale.
|
|
880
|
+
* @private
|
|
881
|
+
*/
|
|
882
|
+
private _onUpdate;
|
|
883
|
+
/**
|
|
884
|
+
* Draws the physics world for this frame. Runs from the app's update event, which fires after
|
|
885
|
+
* the rigid body system has stepped, so the drawn world matches the frame being rendered.
|
|
886
|
+
*
|
|
887
|
+
* @private
|
|
888
|
+
*/
|
|
889
|
+
private _drawPhysics;
|
|
890
|
+
/**
|
|
891
|
+
* Builds the panel inside a shadow root on a host element appended to the document body.
|
|
892
|
+
*
|
|
893
|
+
* @private
|
|
894
|
+
*/
|
|
895
|
+
private _buildDom;
|
|
896
|
+
/**
|
|
897
|
+
* What to preview for the link or row the pointer is over: a texture, or the first attachment of
|
|
898
|
+
* a render target, the way the Render targets tab shows it. The element is checked to still be on
|
|
899
|
+
* screen, as a refresh can remove it and a tab switch hide it without the pointer leaving it. The
|
|
900
|
+
* `:hover` state cannot tell instead: browsers do not reliably report it for elements in a shadow
|
|
901
|
+
* root.
|
|
902
|
+
*
|
|
903
|
+
* @returns {{ texture: Texture, label: string, depth: boolean, channels: HTMLSelectElement, renderTarget?: RenderTarget }|null}
|
|
904
|
+
* The texture to draw and how, or null when nothing previewable is hovered.
|
|
905
|
+
* @private
|
|
906
|
+
*/
|
|
907
|
+
private _hoveredPreview;
|
|
908
|
+
/**
|
|
909
|
+
* @param {HTMLElement} handle - The element to drag.
|
|
910
|
+
* @param {(e: PointerEvent) => void} onMove - Called with every pointer move while dragging.
|
|
911
|
+
* @private
|
|
912
|
+
*/
|
|
913
|
+
private _makeDraggable;
|
|
914
|
+
/**
|
|
915
|
+
* Restores the settings kept under {@link InspectorOptions#storageKey}, if any.
|
|
916
|
+
*
|
|
917
|
+
* @private
|
|
918
|
+
*/
|
|
919
|
+
private _loadSettings;
|
|
920
|
+
/**
|
|
921
|
+
* Writes the settings kept under {@link InspectorOptions#storageKey}, if any. Called whenever
|
|
922
|
+
* one of them changes; suppressed while the panel is being built and restored.
|
|
923
|
+
*
|
|
924
|
+
* @private
|
|
925
|
+
*/
|
|
926
|
+
private _saveSettings;
|
|
927
|
+
/**
|
|
928
|
+
* Includes or excludes one body from the physics drawing, from its checkbox in the list.
|
|
929
|
+
*
|
|
930
|
+
* @param {Entity} entity - The entity carrying the rigid body.
|
|
931
|
+
* @param {boolean} drawn - Whether the body is drawn.
|
|
932
|
+
* @private
|
|
933
|
+
*/
|
|
934
|
+
private _setBodyDrawn;
|
|
935
|
+
/**
|
|
936
|
+
* Keeps the exclusions in step with the engine: a body the engine rebuilt is excluded again, a
|
|
937
|
+
* destroyed one is forgotten without being touched, and an entity that lost its component
|
|
938
|
+
* drops out.
|
|
939
|
+
*
|
|
940
|
+
* @private
|
|
941
|
+
*/
|
|
942
|
+
private _pruneHiddenBodies;
|
|
943
|
+
/**
|
|
944
|
+
* Pushes the physics tab's controls into the debug drawer.
|
|
945
|
+
*
|
|
946
|
+
* @private
|
|
947
|
+
*/
|
|
948
|
+
private _applyPhysicsSettings;
|
|
949
|
+
/**
|
|
950
|
+
* @param {HTMLElement} parent - The bar to add the selector to.
|
|
951
|
+
* @param {string} label - The label.
|
|
952
|
+
* @param {[string, string][]} options - Value and label pairs.
|
|
953
|
+
* @param {string} title - The tooltip.
|
|
954
|
+
* @returns {HTMLSelectElement} The selector.
|
|
955
|
+
* @private
|
|
956
|
+
*/
|
|
957
|
+
private _makeSelect;
|
|
958
|
+
/**
|
|
959
|
+
* @param {HTMLSelectElement} select - The selector.
|
|
960
|
+
* @param {[string, string][]} options - Value and label pairs.
|
|
961
|
+
* @private
|
|
962
|
+
*/
|
|
963
|
+
private _fillSelect;
|
|
964
|
+
/**
|
|
965
|
+
* Draws the selected render target's texture in the free corner of the viewport, on the UI
|
|
966
|
+
* layer: it renders after a camera frame's post-processing and into the backbuffer, so
|
|
967
|
+
* previewing the scene's own color target never samples a texture being rendered to. Runs
|
|
968
|
+
* every frame while the Render targets tab is active; the renderer only shows what is
|
|
969
|
+
* submitted that frame.
|
|
970
|
+
*
|
|
971
|
+
* @private
|
|
972
|
+
*/
|
|
973
|
+
private _drawTargetPreview;
|
|
974
|
+
/**
|
|
975
|
+
* Draws the texture selected on the textures tab, when its preview is enabled. Runs every frame
|
|
976
|
+
* while the tab is active.
|
|
977
|
+
*
|
|
978
|
+
* @private
|
|
979
|
+
*/
|
|
980
|
+
private _drawTexturePreview;
|
|
981
|
+
/**
|
|
982
|
+
* Draws a texture keeping its aspect, either at 30% of the viewport height in the corner the
|
|
983
|
+
* panel leaves free, or as large as fits the part of the viewport the panel leaves free. The
|
|
984
|
+
* quad goes on the UI layer, drawn by the last camera rendering that layer to the screen:
|
|
985
|
+
* cameras rendering into a texture would put the quad in their target, and the UI layer
|
|
986
|
+
* renders after a camera frame's post-processing, so previewing the scene's own color target
|
|
987
|
+
* never samples a texture being rendered to.
|
|
988
|
+
*
|
|
989
|
+
* @param {Texture} texture - The texture.
|
|
990
|
+
* @param {string} label - What is being previewed, for the note.
|
|
991
|
+
* @param {boolean} depth - Whether it is a raw depth texture, which the channel selection
|
|
992
|
+
* does not apply to.
|
|
993
|
+
* @param {HTMLSelectElement|null} channelsSelect - The channel selection to apply, or null for
|
|
994
|
+
* color.
|
|
995
|
+
* @param {'corner'|'large'} [size] - Where and how large to draw it. Defaults to the corner.
|
|
996
|
+
* @param {RenderTarget|null} [renderTarget] - The render target the texture is attached to,
|
|
997
|
+
* which decides whether it is stored upside down. Looked up on the device when not given.
|
|
998
|
+
* @returns {string} What is shown where, or why nothing is.
|
|
999
|
+
* @private
|
|
1000
|
+
*/
|
|
1001
|
+
private _drawPreviewQuad;
|
|
1002
|
+
/**
|
|
1003
|
+
* The largest rectangle of the texture's aspect that fits the part of the viewport the panel
|
|
1004
|
+
* leaves free, in normalized viewport coordinates. The whole viewport is free while the panel
|
|
1005
|
+
* is popped out.
|
|
1006
|
+
*
|
|
1007
|
+
* @param {Texture} texture - The texture to fit.
|
|
1008
|
+
* @returns {{ x: number, y: number, width: number, height: number }} The rectangle.
|
|
1009
|
+
* @private
|
|
1010
|
+
*/
|
|
1011
|
+
private _freePreviewRect;
|
|
1012
|
+
/**
|
|
1013
|
+
* Draws the render target of the pass selected on the frame graph tab, large, when its preview
|
|
1014
|
+
* is on. A pass drawing to the screen needs no preview: the view is its output.
|
|
1015
|
+
*
|
|
1016
|
+
* @private
|
|
1017
|
+
*/
|
|
1018
|
+
private _drawPassPreview;
|
|
1019
|
+
/**
|
|
1020
|
+
* Turns the debug frame on or off. On, it pauses the app, stops the selected forward pass at its
|
|
1021
|
+
* last draw, and takes the arrow keys ahead of the app to step through the draws. Off, the pass
|
|
1022
|
+
* draws in full again and the app returns to its earlier pause state.
|
|
1023
|
+
*
|
|
1024
|
+
* @param {boolean} on - Whether to turn it on.
|
|
1025
|
+
* @private
|
|
1026
|
+
*/
|
|
1027
|
+
private _setDebugFrame;
|
|
1028
|
+
/**
|
|
1029
|
+
* Moves the debug frame to the last draw of a selected pass or layer step. Selecting anything
|
|
1030
|
+
* else leaves it where it was.
|
|
1031
|
+
*
|
|
1032
|
+
* @param {*} item - What the pass list selected.
|
|
1033
|
+
* @param {string|null} key - The key of its row.
|
|
1034
|
+
* @private
|
|
1035
|
+
*/
|
|
1036
|
+
private _moveDebugFrameTo;
|
|
1037
|
+
/**
|
|
1038
|
+
* @param {string} stepKey - The list key of a layer step.
|
|
1039
|
+
* @param {number} index - A draw in its list.
|
|
1040
|
+
* @param {MeshInstance} instance - The instance at that draw.
|
|
1041
|
+
* @private
|
|
1042
|
+
*/
|
|
1043
|
+
private _chooseDebugDraw;
|
|
1044
|
+
/**
|
|
1045
|
+
* Finds the layer step the debug frame stops in, in the latest captured frame. Forward passes
|
|
1046
|
+
* are rebuilt every frame, so the step is found again by its list key each time.
|
|
1047
|
+
*
|
|
1048
|
+
* @returns {{ pass: RenderPassForward, step: *, stepIndex: number, passKey: string, list: import('./frame-graph-view.js').VisibleList|null }|null}
|
|
1049
|
+
* The step, or null when it is not in the frame.
|
|
1050
|
+
* @private
|
|
1051
|
+
*/
|
|
1052
|
+
private _resolveDebugStep;
|
|
1053
|
+
/**
|
|
1054
|
+
* Hands the renderer the limit for this frame: the steps of the pass before the chosen one
|
|
1055
|
+
* draw in full, the chosen one draws up to and including its instance, and the rest draw
|
|
1056
|
+
* nothing, so the pass's target shows exactly what that draw left behind.
|
|
1057
|
+
*
|
|
1058
|
+
* @private
|
|
1059
|
+
*/
|
|
1060
|
+
private _applyDebugFrame;
|
|
1061
|
+
/**
|
|
1062
|
+
* Steps the debug frame one draw on or back, carrying on into the neighboring steps of the same
|
|
1063
|
+
* camera in the pass, and skipping those that drew nothing.
|
|
1064
|
+
*
|
|
1065
|
+
* @param {number} delta - 1 for the next draw, -1 for the previous.
|
|
1066
|
+
* @private
|
|
1067
|
+
*/
|
|
1068
|
+
private _stepDebugDraw;
|
|
1069
|
+
/**
|
|
1070
|
+
* Brings the draw the debug frame stops at into view: its page, and its row.
|
|
1071
|
+
*
|
|
1072
|
+
* @private
|
|
1073
|
+
*/
|
|
1074
|
+
private _revealDebugDraw;
|
|
1075
|
+
/**
|
|
1076
|
+
* Takes the arrow keys while the debug frame is on, ahead of the app, unless typing in a field.
|
|
1077
|
+
*
|
|
1078
|
+
* @param {KeyboardEvent} e - The event.
|
|
1079
|
+
* @returns {boolean} Whether the key stepped the frame.
|
|
1080
|
+
* @private
|
|
1081
|
+
*/
|
|
1082
|
+
private _onDebugKey;
|
|
1083
|
+
/**
|
|
1084
|
+
* @param {{ step: *, list: import('./frame-graph-view.js').VisibleList|null }|null} found - The
|
|
1085
|
+
* step the debug frame stops in, or null.
|
|
1086
|
+
* @private
|
|
1087
|
+
*/
|
|
1088
|
+
private _updateDebugStatus;
|
|
1089
|
+
/**
|
|
1090
|
+
* Words the filter box after what it matches on the active tab, and fills its suggestions with
|
|
1091
|
+
* the component types or script names of the scene while the hierarchy is filtered by those.
|
|
1092
|
+
*
|
|
1093
|
+
* @private
|
|
1094
|
+
*/
|
|
1095
|
+
private _updateFilterHint;
|
|
1096
|
+
/**
|
|
1097
|
+
* @param {HTMLElement} parent - The bar to add the toggle to.
|
|
1098
|
+
* @param {string} label - The label.
|
|
1099
|
+
* @param {string} title - The tooltip.
|
|
1100
|
+
* @returns {HTMLInputElement} The checkbox.
|
|
1101
|
+
* @private
|
|
1102
|
+
*/
|
|
1103
|
+
private _makeToggle;
|
|
1104
|
+
/**
|
|
1105
|
+
* Switches the list tab and points the property view at that tab's selection.
|
|
1106
|
+
*
|
|
1107
|
+
* @param {'hierarchy'|'cameras'|'assets'|'passes'|'targets'|'textures'|'meshes'|'materials'|'scripts'|'memory'|'shaders'|'physics'} tab - The tab.
|
|
1108
|
+
* @private
|
|
1109
|
+
*/
|
|
1110
|
+
private _setTab;
|
|
1111
|
+
/**
|
|
1112
|
+
* Refreshes the active list. The frame graph is re-captured only when asked and not frozen, so
|
|
1113
|
+
* switching tabs keeps the frame the links were built from. Forward passes are recreated every
|
|
1114
|
+
* frame, so the property view is pointed at the current object under the selected row's key.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {boolean} capture - Whether to take a fresh frame snapshot first.
|
|
1117
|
+
* @private
|
|
1118
|
+
*/
|
|
1119
|
+
private _refreshLists;
|
|
1120
|
+
/**
|
|
1121
|
+
* @param {string} value - The filter text, applied to every list.
|
|
1122
|
+
* @private
|
|
1123
|
+
*/
|
|
1124
|
+
private _applyFilter;
|
|
1125
|
+
/**
|
|
1126
|
+
* Reveals a linked object in the tab that lists it: nodes in the hierarchy, passes in the frame
|
|
1127
|
+
* graph, render targets in their list.
|
|
1128
|
+
*
|
|
1129
|
+
* @param {*} target - The object.
|
|
1130
|
+
* @private
|
|
1131
|
+
*/
|
|
1132
|
+
private _selectAny;
|
|
1133
|
+
/**
|
|
1134
|
+
* @returns {PassModelContext & { app: AppBase }} What the model builders need besides their
|
|
1135
|
+
* subject: the app and device, the captured frame, and the paging state and filter of the
|
|
1136
|
+
* instances listed under a forward pass.
|
|
1137
|
+
* @private
|
|
1138
|
+
*/
|
|
1139
|
+
private _context;
|
|
1140
|
+
/**
|
|
1141
|
+
* @param {KeyboardEvent} e - The event.
|
|
1142
|
+
* @private
|
|
1143
|
+
*/
|
|
1144
|
+
private _onKeyDown;
|
|
1145
|
+
/**
|
|
1146
|
+
* @private
|
|
1147
|
+
*/
|
|
1148
|
+
private _onPopupHide;
|
|
1149
|
+
/**
|
|
1150
|
+
* @private
|
|
1151
|
+
*/
|
|
1152
|
+
private _applyVisibility;
|
|
1153
|
+
/**
|
|
1154
|
+
* @param {number} value - The panel width in CSS pixels, clamped to a usable range.
|
|
1155
|
+
* @private
|
|
1156
|
+
*/
|
|
1157
|
+
private _setWidth;
|
|
1158
|
+
/**
|
|
1159
|
+
* @private
|
|
1160
|
+
*/
|
|
1161
|
+
private _applyLayout;
|
|
1162
|
+
/**
|
|
1163
|
+
* @private
|
|
1164
|
+
*/
|
|
1165
|
+
private _applyPauseState;
|
|
1166
|
+
/**
|
|
1167
|
+
* @private
|
|
1168
|
+
*/
|
|
1169
|
+
private _updateStatus;
|
|
1170
|
+
/**
|
|
1171
|
+
* Picking: hovering the view outlines the entity under the pointer, and a click selects it in
|
|
1172
|
+
* the hierarchy. The pointer is taken from the app while it is on.
|
|
1173
|
+
*
|
|
1174
|
+
* @param {boolean} on - Whether to pick.
|
|
1175
|
+
* @private
|
|
1176
|
+
*/
|
|
1177
|
+
private _setPicking;
|
|
1178
|
+
/**
|
|
1179
|
+
* @param {Event} e - A pointer event on the canvas, while picking.
|
|
1180
|
+
* @private
|
|
1181
|
+
*/
|
|
1182
|
+
private _onPickEvent;
|
|
1183
|
+
/**
|
|
1184
|
+
* Picks under the latest pointer position until the pointer rests, outlining what it finds.
|
|
1185
|
+
*
|
|
1186
|
+
* @private
|
|
1187
|
+
*/
|
|
1188
|
+
private _pickHover;
|
|
1189
|
+
/**
|
|
1190
|
+
* Starts Fly or Orbit from its button, or stops it when it is on.
|
|
1191
|
+
*
|
|
1192
|
+
* @param {'fly'|'orbit'} kind - Which.
|
|
1193
|
+
* @private
|
|
1194
|
+
*/
|
|
1195
|
+
private _toggleDrive;
|
|
1196
|
+
/**
|
|
1197
|
+
* @returns {'fly'|'orbit'|null} Which of Fly and Orbit drives the camera, if either does.
|
|
1198
|
+
* @private
|
|
1199
|
+
*/
|
|
1200
|
+
private _driveKind;
|
|
1201
|
+
/**
|
|
1202
|
+
* Flies a camera, or with no camera given, the one camera drawing to the screen, or the one
|
|
1203
|
+
* clicked next when several do.
|
|
1204
|
+
*
|
|
1205
|
+
* @param {CameraComponent|null} camera - The camera to fly, or null to find it from the view.
|
|
1206
|
+
* @private
|
|
1207
|
+
*/
|
|
1208
|
+
private _startFly;
|
|
1209
|
+
/**
|
|
1210
|
+
* Flies a camera, or orbits it around the selected node. With no camera given, drives the one
|
|
1211
|
+
* camera drawing to the screen, or the one clicked next when several do.
|
|
1212
|
+
*
|
|
1213
|
+
* @param {'fly'|'orbit'} kind - Whether to fly or to orbit.
|
|
1214
|
+
* @param {CameraComponent|null} camera - The camera to drive, or null to find it from the view.
|
|
1215
|
+
* @private
|
|
1216
|
+
*/
|
|
1217
|
+
private _startDrive;
|
|
1218
|
+
/** @private */
|
|
1219
|
+
private _stopFly;
|
|
1220
|
+
/**
|
|
1221
|
+
* Orbit needs a node to orbit around, so its button is off until one is selected.
|
|
1222
|
+
*
|
|
1223
|
+
* @private
|
|
1224
|
+
*/
|
|
1225
|
+
private _applyOrbitState;
|
|
1226
|
+
/**
|
|
1227
|
+
* Takes the pointer on the canvas for a mode, and Esc to end it.
|
|
1228
|
+
*
|
|
1229
|
+
* @param {'pick'|'choose'} mode - The mode.
|
|
1230
|
+
* @param {(e: Event) => void} onEvent - Called with the pointer events.
|
|
1231
|
+
* @private
|
|
1232
|
+
*/
|
|
1233
|
+
private _takeCanvas;
|
|
1234
|
+
/** @private */
|
|
1235
|
+
private _releaseCanvas;
|
|
1236
|
+
/**
|
|
1237
|
+
* @param {KeyboardEvent} e - A key pressed while the canvas is taken.
|
|
1238
|
+
* @private
|
|
1239
|
+
*/
|
|
1240
|
+
private _onModeKey;
|
|
1241
|
+
/**
|
|
1242
|
+
* Ends every mode that changes the view: picking, flying, the render modes and wireframe.
|
|
1243
|
+
*
|
|
1244
|
+
* @private
|
|
1245
|
+
*/
|
|
1246
|
+
private _endViewportModes;
|
|
1247
|
+
/**
|
|
1248
|
+
* Puts back the shader pass each camera had before the panel changed it, and turns wireframe
|
|
1249
|
+
* off.
|
|
1250
|
+
*
|
|
1251
|
+
* @private
|
|
1252
|
+
*/
|
|
1253
|
+
private _resetRenderOverrides;
|
|
1254
|
+
/**
|
|
1255
|
+
* Enables the reset button while a camera renders with a changed mode or wireframe is on.
|
|
1256
|
+
*
|
|
1257
|
+
* @private
|
|
1258
|
+
*/
|
|
1259
|
+
private _updateResetButton;
|
|
1260
|
+
/**
|
|
1261
|
+
* Applies the render mode chosen on the Cameras tab to the selected camera, or to every camera,
|
|
1262
|
+
* keeping the shader pass each had to put back when the panel closes.
|
|
1263
|
+
*
|
|
1264
|
+
* @private
|
|
1265
|
+
*/
|
|
1266
|
+
private _applyRenderMode;
|
|
1267
|
+
/**
|
|
1268
|
+
* @returns {CameraComponent|null} The camera the render mode is switched for, or null when it is
|
|
1269
|
+
* switched for all of them.
|
|
1270
|
+
* @private
|
|
1271
|
+
*/
|
|
1272
|
+
private _scopeCamera;
|
|
1273
|
+
/** @private */
|
|
1274
|
+
private _applyWireframe;
|
|
1275
|
+
/**
|
|
1276
|
+
* Says in the status bar what the view is doing while it is picked or flown.
|
|
1277
|
+
*
|
|
1278
|
+
* @private
|
|
1279
|
+
*/
|
|
1280
|
+
private _updateModeStatus;
|
|
1281
|
+
/**
|
|
1282
|
+
* Outlines a node in the viewport for the current frame.
|
|
1283
|
+
*
|
|
1284
|
+
* @param {GraphNode} node - The node.
|
|
1285
|
+
* @param {Color} [color] - The color to outline it in. Defaults to the highlight color.
|
|
1286
|
+
* @private
|
|
1287
|
+
*/
|
|
1288
|
+
private _drawHighlight;
|
|
1289
|
+
/**
|
|
1290
|
+
* {@link lockedNode} and its ancestors cannot be disabled from the panel, as that would switch
|
|
1291
|
+
* the panel off with them.
|
|
1292
|
+
*
|
|
1293
|
+
* @param {GraphNode} node - The node.
|
|
1294
|
+
* @returns {boolean} Whether the node's enabled checkbox is withheld.
|
|
1295
|
+
* @private
|
|
1296
|
+
*/
|
|
1297
|
+
private _isLocked;
|
|
1298
|
+
/**
|
|
1299
|
+
* @param {GraphNode} node - The node.
|
|
1300
|
+
* @returns {number} A size that reads well from the closest camera.
|
|
1301
|
+
* @private
|
|
1302
|
+
*/
|
|
1303
|
+
private _highlightSize;
|
|
1304
|
+
}
|