@playcanvas/inspector 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -26
- package/package.json +12 -6
- package/src/asset-view.js +24 -17
- package/src/camera-view.js +5 -3
- package/src/context-menu.js +231 -0
- package/src/copy-json.js +692 -0
- package/src/describe.js +51 -2
- package/src/frame-graph-view.js +1 -0
- package/src/hierarchy-view.js +29 -3
- package/src/inspector.js +406 -59
- package/src/list-view.js +118 -12
- package/src/material-view.js +7 -6
- package/src/memory-view.js +224 -66
- package/src/mesh-view.js +6 -5
- package/src/model.js +24 -2
- package/src/node-model.js +78 -9
- package/src/property-view.js +159 -5
- package/src/render-target-view.js +3 -3
- package/src/script-view.js +21 -12
- package/src/styles.js +196 -2
- package/src/texture-view.js +4 -4
- package/src/transform-tool.js +185 -0
- package/types/asset-usage.d.ts +2 -0
- package/types/asset-view.d.ts +17 -10
- package/types/camera-view.d.ts +12 -6
- package/types/context-menu.d.ts +90 -0
- package/types/copy-json.d.ts +69 -0
- package/types/describe.d.ts +3 -2
- package/types/entity-inspector-script.d.ts +2 -2
- package/types/frame-graph-view.d.ts +6 -2
- package/types/hierarchy-view.d.ts +25 -11
- package/types/input/fly-controller.d.ts +4 -4
- package/types/input/input.d.ts +2 -2
- package/types/input/orbit-controller.d.ts +6 -6
- package/types/input/pose.d.ts +9 -7
- package/types/inspector.d.ts +144 -22
- package/types/instance-survey.d.ts +3 -1
- package/types/list-view.d.ts +44 -3
- package/types/material-view.d.ts +13 -6
- package/types/memory-view.d.ts +37 -30
- package/types/mesh-view.d.ts +12 -5
- package/types/model.d.ts +21 -3
- package/types/node-model.d.ts +30 -6
- package/types/physics-debug.d.ts +9 -5
- package/types/physics-view.d.ts +8 -6
- package/types/picker/picker.d.ts +15 -6
- package/types/picker/render-pass-picker.d.ts +16 -10
- package/types/property-view.d.ts +41 -0
- package/types/render-target-view.d.ts +10 -7
- package/types/renderers/texture-renderer-shaders.d.ts +1 -1
- package/types/renderers/texture-renderer.d.ts +11 -5
- package/types/renderers/wire-renderer.d.ts +14 -5
- package/types/script-view.d.ts +10 -4
- package/types/shader-view.d.ts +10 -6
- package/types/texture-view.d.ts +8 -5
- package/types/transform-tool.d.ts +92 -0
- package/types/viewport-tools.d.ts +25 -18
|
@@ -13,7 +13,7 @@ export type PreviewAttachment = {
|
|
|
13
13
|
/**
|
|
14
14
|
* - The texture to sample.
|
|
15
15
|
*/
|
|
16
|
-
texture:
|
|
16
|
+
texture: Texture;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Everything the property view shows for a render target: its setup, the passes that rendered
|
|
@@ -23,8 +23,8 @@ export type PreviewAttachment = {
|
|
|
23
23
|
* @param {{ device: GraphicsDevice, frame: FrameSnapshot|null }} ctx - The device and the captured frame.
|
|
24
24
|
* @returns {PropertySection[]} The sections.
|
|
25
25
|
*/
|
|
26
|
-
export function buildRenderTargetModel(rt:
|
|
27
|
-
device:
|
|
26
|
+
export function buildRenderTargetModel(rt: RenderTarget, ctx: {
|
|
27
|
+
device: GraphicsDevice;
|
|
28
28
|
frame: FrameSnapshot | null;
|
|
29
29
|
}): PropertySection[];
|
|
30
30
|
/**
|
|
@@ -60,7 +60,7 @@ export function isDepthFormat(format: number): boolean;
|
|
|
60
60
|
* @param {GraphicsDevice} device - The device.
|
|
61
61
|
* @returns {PreviewAttachment[]} The attachments, in selector order.
|
|
62
62
|
*/
|
|
63
|
-
export function previewAttachments(rt:
|
|
63
|
+
export function previewAttachments(rt: RenderTarget, device: GraphicsDevice): PreviewAttachment[];
|
|
64
64
|
/**
|
|
65
65
|
* Mirrors the checks TextureRenderer applies before drawing, so the panel can say why a texture
|
|
66
66
|
* cannot be shown instead of letting the renderer warn once and draw nothing.
|
|
@@ -69,7 +69,7 @@ export function previewAttachments(rt: FILTER_NEAREST, device: FILTER_NEAREST):
|
|
|
69
69
|
* @param {GraphicsDevice} device - The device.
|
|
70
70
|
* @returns {{ ok: boolean, reason: string }} Whether it can be previewed, and if not, why.
|
|
71
71
|
*/
|
|
72
|
-
export function previewSupport(texture:
|
|
72
|
+
export function previewSupport(texture: Texture | null, device: GraphicsDevice): {
|
|
73
73
|
ok: boolean;
|
|
74
74
|
reason: string;
|
|
75
75
|
};
|
|
@@ -80,7 +80,7 @@ export function previewSupport(texture: FILTER_NEAREST | null, device: FILTER_NE
|
|
|
80
80
|
* @param {FrameSnapshot|null} frame - The captured frame, for usage counts.
|
|
81
81
|
* @returns {ListRow[]} The rows.
|
|
82
82
|
*/
|
|
83
|
-
export function renderTargetRows(device:
|
|
83
|
+
export function renderTargetRows(device: GraphicsDevice, frame: FrameSnapshot | null): ListRow[];
|
|
84
84
|
/**
|
|
85
85
|
* Whether a texture holds its rows bottom-up, as a render target with the bottom origin stores
|
|
86
86
|
* them, or with the native origin on WebGL2. The texture renderer shows row 0 at the top, so such
|
|
@@ -92,7 +92,10 @@ export function renderTargetRows(device: FILTER_NEAREST, frame: FrameSnapshot |
|
|
|
92
92
|
* when not given.
|
|
93
93
|
* @returns {boolean} Whether it is stored bottom-up.
|
|
94
94
|
*/
|
|
95
|
-
export function storedBottomUp(texture:
|
|
95
|
+
export function storedBottomUp(texture: Texture, device: GraphicsDevice, rt?: RenderTarget | null): boolean;
|
|
96
|
+
import type { Texture } from 'playcanvas';
|
|
97
|
+
import type { RenderTarget } from 'playcanvas';
|
|
98
|
+
import type { GraphicsDevice } from 'playcanvas';
|
|
96
99
|
import type { FrameSnapshot } from './frame-graph-view.js';
|
|
97
100
|
import type { PropertySection } from './model.js';
|
|
98
101
|
import type { ListRow } from './list-view.js';
|
|
@@ -22,7 +22,7 @@ export type TextureSlot = {
|
|
|
22
22
|
/**
|
|
23
23
|
* - The texture shown this frame, or null.
|
|
24
24
|
*/
|
|
25
|
-
texture:
|
|
25
|
+
texture: Texture | null;
|
|
26
26
|
};
|
|
27
27
|
export type TexturePool = {
|
|
28
28
|
/**
|
|
@@ -98,21 +98,21 @@ export class TextureRenderer {
|
|
|
98
98
|
*
|
|
99
99
|
* @param {AppBase} app - The application to render into and bind resource lifetime to.
|
|
100
100
|
*/
|
|
101
|
-
constructor(app:
|
|
101
|
+
constructor(app: AppBase);
|
|
102
102
|
/**
|
|
103
103
|
* The layer used by subsequent draw calls, or null to use the application's default debug
|
|
104
104
|
* drawing layer (normally Immediate). Defaults to null.
|
|
105
105
|
*
|
|
106
106
|
* @type {Layer|null}
|
|
107
107
|
*/
|
|
108
|
-
layer:
|
|
108
|
+
layer: Layer | null;
|
|
109
109
|
/**
|
|
110
110
|
* The only camera that draws the previews, or null to let every camera rendering the
|
|
111
111
|
* destination layer draw them. Defaults to null.
|
|
112
112
|
*
|
|
113
113
|
* @type {CameraComponent|null}
|
|
114
114
|
*/
|
|
115
|
-
camera:
|
|
115
|
+
camera: CameraComponent | null;
|
|
116
116
|
/** @private */
|
|
117
117
|
private _channels;
|
|
118
118
|
/** @private */
|
|
@@ -169,7 +169,7 @@ export class TextureRenderer {
|
|
|
169
169
|
* @param {number} width - Width as a fraction of the camera viewport width.
|
|
170
170
|
* @param {number} height - Height as a fraction of the camera viewport height.
|
|
171
171
|
*/
|
|
172
|
-
draw(texture:
|
|
172
|
+
draw(texture: Texture, x: number, y: number, width: number, height: number): void;
|
|
173
173
|
/**
|
|
174
174
|
* Displays the rendering camera's scene depth for this frame, linearized and normalized by
|
|
175
175
|
* its far clip distance. The camera must already supply a scene depth map, for example using
|
|
@@ -229,3 +229,9 @@ export class TextureRenderer {
|
|
|
229
229
|
*/
|
|
230
230
|
destroy(): void;
|
|
231
231
|
}
|
|
232
|
+
import { MeshInstance } from 'playcanvas';
|
|
233
|
+
import { ShaderMaterial } from 'playcanvas';
|
|
234
|
+
import type { Texture } from 'playcanvas';
|
|
235
|
+
import type { Layer } from 'playcanvas';
|
|
236
|
+
import type { CameraComponent } from 'playcanvas';
|
|
237
|
+
import type { AppBase } from 'playcanvas';
|
|
@@ -42,7 +42,7 @@ export class WireRenderer {
|
|
|
42
42
|
* @example
|
|
43
43
|
* const wire = new WireRenderer(app);
|
|
44
44
|
*/
|
|
45
|
-
constructor(app:
|
|
45
|
+
constructor(app: AppBase);
|
|
46
46
|
/**
|
|
47
47
|
* The color used by shapes, specified in sRGB color space. The alpha component is respected.
|
|
48
48
|
* Defaults to white.
|
|
@@ -56,7 +56,7 @@ export class WireRenderer {
|
|
|
56
56
|
*
|
|
57
57
|
* @type {Layer|null}
|
|
58
58
|
*/
|
|
59
|
-
layer:
|
|
59
|
+
layer: Layer | null;
|
|
60
60
|
/**
|
|
61
61
|
* Whether shapes are depth tested against the depth buffer. Defaults to true.
|
|
62
62
|
*
|
|
@@ -216,7 +216,7 @@ export class WireRenderer {
|
|
|
216
216
|
* @example
|
|
217
217
|
* wire.box(meshInstance.aabb);
|
|
218
218
|
*/
|
|
219
|
-
box(box:
|
|
219
|
+
box(box: BoundingBox | OrientedBox): void;
|
|
220
220
|
/**
|
|
221
221
|
* Renders a sphere as three great circles, one in each of the primary planes.
|
|
222
222
|
*
|
|
@@ -330,7 +330,7 @@ export class WireRenderer {
|
|
|
330
330
|
* @example
|
|
331
331
|
* wire.frustum(otherCamera.camera);
|
|
332
332
|
*/
|
|
333
|
-
frustum(source:
|
|
333
|
+
frustum(source: CameraComponent | Mat4): void;
|
|
334
334
|
/**
|
|
335
335
|
* Renders the shape and extent of a light, using the light's own color. An omni light is drawn
|
|
336
336
|
* as a sphere of its range, a spot light as its cone, and a directional light as an arrow
|
|
@@ -343,5 +343,14 @@ export class WireRenderer {
|
|
|
343
343
|
* @example
|
|
344
344
|
* wire.light(entity.light);
|
|
345
345
|
*/
|
|
346
|
-
light(light:
|
|
346
|
+
light(light: LightComponent, size?: number): void;
|
|
347
347
|
}
|
|
348
|
+
import { Color } from 'playcanvas';
|
|
349
|
+
import type { Layer } from 'playcanvas';
|
|
350
|
+
import { Mat4 } from 'playcanvas';
|
|
351
|
+
import type { AppBase } from 'playcanvas';
|
|
352
|
+
import { Vec3 } from 'playcanvas';
|
|
353
|
+
import type { BoundingBox } from 'playcanvas';
|
|
354
|
+
import type { OrientedBox } from 'playcanvas';
|
|
355
|
+
import type { CameraComponent } from 'playcanvas';
|
|
356
|
+
import type { LightComponent } from 'playcanvas';
|
package/types/script-view.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type ScriptEntry = {
|
|
|
16
16
|
*/
|
|
17
17
|
instances: {
|
|
18
18
|
script: Script | ScriptType;
|
|
19
|
-
entity:
|
|
19
|
+
entity: Entity;
|
|
20
20
|
}[];
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -24,11 +24,13 @@ export type ScriptEntry = {
|
|
|
24
24
|
* using it, each instance opening in place into its attributes, and its source.
|
|
25
25
|
*
|
|
26
26
|
* @param {Function} cls - The script class.
|
|
27
|
-
* @param {{ app: AppBase }} ctx - The app
|
|
27
|
+
* @param {{ app: AppBase, backlinks?: boolean }} ctx - The app, and whether to list the entities
|
|
28
|
+
* using the class, which a copy has no use for.
|
|
28
29
|
* @returns {PropertySection[]} The sections.
|
|
29
30
|
*/
|
|
30
31
|
export function buildScriptModel(cls: Function, ctx: {
|
|
31
|
-
app:
|
|
32
|
+
app: AppBase;
|
|
33
|
+
backlinks?: boolean;
|
|
32
34
|
}): PropertySection[];
|
|
33
35
|
/**
|
|
34
36
|
* @param {Function} cls - A class.
|
|
@@ -51,6 +53,10 @@ export function scriptListRows(survey: Map<Function, ScriptEntry>): ListRow[];
|
|
|
51
53
|
* @param {AppBase} app - The app.
|
|
52
54
|
* @returns {Map<Function, ScriptEntry>} The script classes, the registered ones first.
|
|
53
55
|
*/
|
|
54
|
-
export function surveyScripts(app:
|
|
56
|
+
export function surveyScripts(app: AppBase): Map<Function, ScriptEntry>;
|
|
57
|
+
import { Script } from 'playcanvas';
|
|
58
|
+
import { ScriptType } from 'playcanvas';
|
|
59
|
+
import type { Entity } from 'playcanvas';
|
|
60
|
+
import type { AppBase } from 'playcanvas';
|
|
55
61
|
import type { PropertySection } from './model.js';
|
|
56
62
|
import type { ListRow } from './list-view.js';
|
package/types/shader-view.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {Shader} shader - The shader.
|
|
7
7
|
* @returns {PropertySection[]} The sections.
|
|
8
8
|
*/
|
|
9
|
-
export function buildShaderModel(shader:
|
|
9
|
+
export function buildShaderModel(shader: Shader): PropertySection[];
|
|
10
10
|
/**
|
|
11
11
|
* Every shader alive on the device, in creation order. A shader whose definition had no source
|
|
12
12
|
* never reached the device and is not listed; one that failed to compile is.
|
|
@@ -14,7 +14,7 @@ export function buildShaderModel(shader: bindGroupNames): PropertySection[];
|
|
|
14
14
|
* @param {GraphicsDevice} device - The device.
|
|
15
15
|
* @returns {Shader[]} The shaders.
|
|
16
16
|
*/
|
|
17
|
-
export function collectShaders(device:
|
|
17
|
+
export function collectShaders(device: GraphicsDevice): Shader[];
|
|
18
18
|
/**
|
|
19
19
|
* Lays out a bind group format as text: its uniform buffers, textures and storage resources with
|
|
20
20
|
* their slots and the stages that can see them.
|
|
@@ -22,25 +22,29 @@ export function collectShaders(device: bindGroupNames): bindGroupNames[];
|
|
|
22
22
|
* @param {BindGroupFormat} format - The format.
|
|
23
23
|
* @returns {string} The layout.
|
|
24
24
|
*/
|
|
25
|
-
export function formatBindGroup(format:
|
|
25
|
+
export function formatBindGroup(format: BindGroupFormat): string;
|
|
26
26
|
/**
|
|
27
27
|
* Lays out a uniform buffer format as text: the std140 offsets, sizes and types of its uniforms.
|
|
28
28
|
*
|
|
29
29
|
* @param {UniformBufferFormat} format - The format.
|
|
30
30
|
* @returns {string} The layout.
|
|
31
31
|
*/
|
|
32
|
-
export function formatUniformBuffer(format:
|
|
32
|
+
export function formatUniformBuffer(format: UniformBufferFormat): string;
|
|
33
33
|
/**
|
|
34
34
|
* One row per shader on the device, tagged with its language, compute shaders and failures.
|
|
35
35
|
*
|
|
36
36
|
* @param {GraphicsDevice} device - The device.
|
|
37
37
|
* @returns {ListRow[]} The rows.
|
|
38
38
|
*/
|
|
39
|
-
export function shaderRows(device:
|
|
39
|
+
export function shaderRows(device: GraphicsDevice): ListRow[];
|
|
40
40
|
/**
|
|
41
41
|
* @param {Shader} shader - A shader.
|
|
42
42
|
* @returns {string} The compilation state: 'failed', 'ready' or 'compiling'.
|
|
43
43
|
*/
|
|
44
|
-
export function stateName(shader:
|
|
44
|
+
export function stateName(shader: Shader): string;
|
|
45
|
+
import type { Shader } from 'playcanvas';
|
|
45
46
|
import type { PropertySection } from './model.js';
|
|
47
|
+
import type { GraphicsDevice } from 'playcanvas';
|
|
48
|
+
import type { BindGroupFormat } from 'playcanvas';
|
|
49
|
+
import type { UniformBufferFormat } from 'playcanvas';
|
|
46
50
|
import type { ListRow } from './list-view.js';
|
package/types/texture-view.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* asset the texture was loaded from.
|
|
8
8
|
* @returns {PropertySection[]} The sections.
|
|
9
9
|
*/
|
|
10
|
-
export function buildTextureModel(texture:
|
|
11
|
-
device:
|
|
12
|
-
app?:
|
|
10
|
+
export function buildTextureModel(texture: Texture, ctx: {
|
|
11
|
+
device: GraphicsDevice;
|
|
12
|
+
app?: AppBase;
|
|
13
13
|
}): PropertySection[];
|
|
14
14
|
/**
|
|
15
15
|
* Every texture alive on the device, largest GPU footprint first. The device keeps a registry of
|
|
@@ -18,13 +18,16 @@ export function buildTextureModel(texture: ADDRESS_CLAMP_TO_EDGE, ctx: {
|
|
|
18
18
|
* @param {GraphicsDevice} device - The device.
|
|
19
19
|
* @returns {Texture[]} The textures.
|
|
20
20
|
*/
|
|
21
|
-
export function collectTextures(device:
|
|
21
|
+
export function collectTextures(device: GraphicsDevice): Texture[];
|
|
22
22
|
/**
|
|
23
23
|
* One row per texture on the device, largest first, tagged when it is a render target attachment.
|
|
24
24
|
*
|
|
25
25
|
* @param {GraphicsDevice} device - The device.
|
|
26
26
|
* @returns {ListRow[]} The rows.
|
|
27
27
|
*/
|
|
28
|
-
export function textureRows(device:
|
|
28
|
+
export function textureRows(device: GraphicsDevice): ListRow[];
|
|
29
|
+
import type { Texture } from 'playcanvas';
|
|
30
|
+
import type { GraphicsDevice } from 'playcanvas';
|
|
31
|
+
import type { AppBase } from 'playcanvas';
|
|
29
32
|
import type { PropertySection } from './model.js';
|
|
30
33
|
import type { ListRow } from './list-view.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type TransformMode = "translate" | "rotate" | "scale";
|
|
2
|
+
declare const POINTER_EVENTS: string[];
|
|
3
|
+
/**
|
|
4
|
+
* Moves, rotates or scales a node in the view with one of the engine's transform gizmos, drawn on
|
|
5
|
+
* a layer of its own over the view of a camera. The gizmo listens to the canvas itself, after the
|
|
6
|
+
* app's own listeners, so a drag of its handles would also reach the app and move its camera too.
|
|
7
|
+
* The tool takes those listeners away and hands the gizmo the pointer itself: a press on a handle
|
|
8
|
+
* and the drag that follows go to the gizmo alone, and everything else to the app as usual.
|
|
9
|
+
*
|
|
10
|
+
* The gizmo has no public way to be handed input, so it is handed its own pointer handlers. Engines
|
|
11
|
+
* whose gizmos lack them get no tool, see {@link TransformTool.supported}.
|
|
12
|
+
*
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
export class TransformTool {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the engine's gizmos can be driven by the tool.
|
|
18
|
+
*
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
static get supported(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @param {AppBase} app - The app.
|
|
24
|
+
* @param {TransformMode} mode - What the tool does to the node.
|
|
25
|
+
* @param {CameraComponent} camera - The camera whose view the gizmo is drawn and used in.
|
|
26
|
+
* @param {() => void} [onTransform] - Called whenever the gizmo changes the node.
|
|
27
|
+
*/
|
|
28
|
+
constructor(app: AppBase, mode: TransformMode, camera: CameraComponent, onTransform?: () => void);
|
|
29
|
+
/**
|
|
30
|
+
* What the tool does to the node.
|
|
31
|
+
*
|
|
32
|
+
* @type {TransformMode}
|
|
33
|
+
*/
|
|
34
|
+
mode: TransformMode;
|
|
35
|
+
/**
|
|
36
|
+
* @type {AppBase}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private _app;
|
|
40
|
+
/**
|
|
41
|
+
* @type {Layer}
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private _layer;
|
|
45
|
+
/**
|
|
46
|
+
* @type {any}
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
private _gizmo;
|
|
50
|
+
/**
|
|
51
|
+
* Whether a handle is being dragged, which keeps the pointer from the app until it is let go.
|
|
52
|
+
*
|
|
53
|
+
* @type {boolean}
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
private _dragging;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the click that follows the end of a drag is still to come, to keep it from the app.
|
|
59
|
+
*
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private _endingDrag;
|
|
64
|
+
/**
|
|
65
|
+
* The entity of the gizmo, which the app's hierarchy holds while the tool is on.
|
|
66
|
+
*
|
|
67
|
+
* @type {Entity}
|
|
68
|
+
*/
|
|
69
|
+
get root(): Entity;
|
|
70
|
+
/**
|
|
71
|
+
* Puts the gizmo on a node, or takes it off.
|
|
72
|
+
*
|
|
73
|
+
* @param {GraphNode|null} node - The node, or null for none.
|
|
74
|
+
*/
|
|
75
|
+
attach(node: GraphNode | null): void;
|
|
76
|
+
/**
|
|
77
|
+
* Hands the gizmo a pointer event on the canvas, ahead of everything else listening to it.
|
|
78
|
+
*
|
|
79
|
+
* @param {Event} e - The event.
|
|
80
|
+
* @returns {boolean} Whether the gizmo keeps the event, which nothing else is then to see.
|
|
81
|
+
*/
|
|
82
|
+
handle(e: Event): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Takes the gizmo, its layer and its entity out of the app.
|
|
85
|
+
*/
|
|
86
|
+
destroy(): void;
|
|
87
|
+
}
|
|
88
|
+
import type { Entity } from 'playcanvas';
|
|
89
|
+
import type { GraphNode } from 'playcanvas';
|
|
90
|
+
import type { AppBase } from 'playcanvas';
|
|
91
|
+
import type { CameraComponent } from 'playcanvas';
|
|
92
|
+
export { POINTER_EVENTS as TRANSFORM_POINTER_EVENTS };
|
|
@@ -34,9 +34,9 @@ export class CameraOrbit extends CameraDrive {
|
|
|
34
34
|
* @param {GraphNode} target - The node to orbit around.
|
|
35
35
|
* @param {() => void} onEnd - Called when the orbit ends from the keyboard.
|
|
36
36
|
*/
|
|
37
|
-
constructor(app:
|
|
37
|
+
constructor(app: AppBase, camera: CameraComponent, target: GraphNode, onEnd: () => void);
|
|
38
38
|
/** @type {GraphNode} */
|
|
39
|
-
target:
|
|
39
|
+
target: GraphNode;
|
|
40
40
|
/** @type {OrbitController} */
|
|
41
41
|
_controller: OrbitController;
|
|
42
42
|
/** @type {InputFrame<{ move: number[], rotate: number[] }>} */
|
|
@@ -47,9 +47,9 @@ export class CameraOrbit extends CameraDrive {
|
|
|
47
47
|
/** The pose drawn last, for a change of target to turn from. */
|
|
48
48
|
_pose: Pose;
|
|
49
49
|
/** The center of the target's bounds, relative to its position. */
|
|
50
|
-
_center:
|
|
50
|
+
_center: Vec3;
|
|
51
51
|
/** Where the orbit was centered last frame, to follow the target by. */
|
|
52
|
-
_focus:
|
|
52
|
+
_focus: Vec3;
|
|
53
53
|
/** @type {'orbit'|'pan'|null} */
|
|
54
54
|
_drag: "orbit" | "pan" | null;
|
|
55
55
|
_lastX: number;
|
|
@@ -59,7 +59,7 @@ export class CameraOrbit extends CameraDrive {
|
|
|
59
59
|
*
|
|
60
60
|
* @param {GraphNode} target - The node to orbit around.
|
|
61
61
|
*/
|
|
62
|
-
setTarget(target:
|
|
62
|
+
setTarget(target: GraphNode): void;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Takes the pointer events on the canvas ahead of the app's own handlers, for a mode of the
|
|
@@ -88,7 +88,7 @@ export class CanvasCapture {
|
|
|
88
88
|
* The shader passes a camera can render with, as the editor offers them: the lit scene, and the
|
|
89
89
|
* debug views of the standard material's inputs.
|
|
90
90
|
*/
|
|
91
|
-
export const RENDER_MODES:
|
|
91
|
+
export const RENDER_MODES: string[][];
|
|
92
92
|
/**
|
|
93
93
|
* Picks the entity under the pointer, through the screen camera whose viewport holds it, the way
|
|
94
94
|
* the editor picks: an id buffer the size of the canvas is rendered for that camera, which draws
|
|
@@ -98,9 +98,9 @@ export class ViewportPicker {
|
|
|
98
98
|
/**
|
|
99
99
|
* @param {AppBase} app - The app.
|
|
100
100
|
*/
|
|
101
|
-
constructor(app:
|
|
101
|
+
constructor(app: AppBase);
|
|
102
102
|
/** @type {AppBase} */
|
|
103
|
-
app:
|
|
103
|
+
app: AppBase;
|
|
104
104
|
/** @type {Picker|null} */
|
|
105
105
|
_picker: Picker | null;
|
|
106
106
|
/**
|
|
@@ -117,8 +117,8 @@ export class ViewportPicker {
|
|
|
117
117
|
*/
|
|
118
118
|
pick(clientX: number, clientY: number): Promise<{
|
|
119
119
|
entity: Entity;
|
|
120
|
-
instance:
|
|
121
|
-
camera:
|
|
120
|
+
instance: MeshInstance;
|
|
121
|
+
camera: CameraComponent;
|
|
122
122
|
} | null>;
|
|
123
123
|
/**
|
|
124
124
|
* @param {number} clientX - The pointer, in client pixels.
|
|
@@ -137,11 +137,11 @@ export class ViewportPicker {
|
|
|
137
137
|
*/
|
|
138
138
|
export class WireframeMode {
|
|
139
139
|
/** @type {Map<MeshInstance, number>} */
|
|
140
|
-
_styles: Map<
|
|
140
|
+
_styles: Map<MeshInstance, number>;
|
|
141
141
|
/**
|
|
142
142
|
* @param {AppBase} app - The app, whose mesh instances to draw in wireframe.
|
|
143
143
|
*/
|
|
144
|
-
apply(app:
|
|
144
|
+
apply(app: AppBase): void;
|
|
145
145
|
/** Puts back the render style of every mesh instance drawn in wireframe. */
|
|
146
146
|
restore(): void;
|
|
147
147
|
}
|
|
@@ -149,7 +149,7 @@ export class WireframeMode {
|
|
|
149
149
|
* @param {CameraComponent} camera - A camera.
|
|
150
150
|
* @returns {boolean} Whether it draws to the screen, the ones a pointer can be over.
|
|
151
151
|
*/
|
|
152
|
-
export function isScreenCamera(camera:
|
|
152
|
+
export function isScreenCamera(camera: CameraComponent): boolean;
|
|
153
153
|
/**
|
|
154
154
|
* The screen camera whose viewport holds a point of the canvas, the last one drawn when several
|
|
155
155
|
* overlap, which is the one on top.
|
|
@@ -159,7 +159,7 @@ export function isScreenCamera(camera: BoundingBox): boolean;
|
|
|
159
159
|
* @param {number} y - The point, as a fraction of the canvas height from its top edge.
|
|
160
160
|
* @returns {CameraComponent|null} The camera, or null when no camera draws there.
|
|
161
161
|
*/
|
|
162
|
-
export function screenCameraAt(app:
|
|
162
|
+
export function screenCameraAt(app: AppBase, x: number, y: number): CameraComponent | null;
|
|
163
163
|
/**
|
|
164
164
|
* Drives a camera the app keeps drawing with, from the inspector's own input. The app may move the
|
|
165
165
|
* camera itself, from a script or from code of its own, so the camera is not taken over: its
|
|
@@ -178,15 +178,15 @@ declare class CameraDrive {
|
|
|
178
178
|
* @param {CameraComponent} camera - The camera to drive.
|
|
179
179
|
* @param {() => void} onEnd - Called when the drive ends from the keyboard.
|
|
180
180
|
*/
|
|
181
|
-
constructor(app:
|
|
181
|
+
constructor(app: AppBase, camera: CameraComponent, onEnd: () => void);
|
|
182
182
|
/** @type {AppBase} */
|
|
183
|
-
app:
|
|
183
|
+
app: AppBase;
|
|
184
184
|
/** @type {CameraComponent} */
|
|
185
|
-
camera:
|
|
185
|
+
camera: CameraComponent;
|
|
186
186
|
/** @type {{ position: Vec3, rotation: Quat, fov: number, orthoHeight: number }|null} */
|
|
187
187
|
_saved: {
|
|
188
188
|
position: Vec3;
|
|
189
|
-
rotation:
|
|
189
|
+
rotation: Quat;
|
|
190
190
|
fov: number;
|
|
191
191
|
orthoHeight: number;
|
|
192
192
|
} | null;
|
|
@@ -232,6 +232,13 @@ declare class CameraDrive {
|
|
|
232
232
|
import { FlyController } from './input/fly-controller.js';
|
|
233
233
|
import { InputFrame } from './input/input.js';
|
|
234
234
|
import { Pose } from './input/pose.js';
|
|
235
|
+
import type { GraphNode } from 'playcanvas';
|
|
235
236
|
import { OrbitController } from './input/orbit-controller.js';
|
|
237
|
+
import { Vec3 } from 'playcanvas';
|
|
238
|
+
import type { AppBase } from 'playcanvas';
|
|
239
|
+
import type { CameraComponent } from 'playcanvas';
|
|
236
240
|
import { Picker } from './picker/picker.js';
|
|
241
|
+
import { Entity } from 'playcanvas';
|
|
242
|
+
import type { MeshInstance } from 'playcanvas';
|
|
243
|
+
import type { Quat } from 'playcanvas';
|
|
237
244
|
export {};
|