@dreamcomposer/engine-types 0.0.1
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/EngineState.d.ts +4 -0
- package/Layer.d.ts +102 -0
- package/NoUndefinedField.d.ts +3 -0
- package/README.md +17 -0
- package/from-engine/AckMessage.d.ts +24 -0
- package/from-engine/CanvasImageUrlMessage.d.ts +27 -0
- package/from-engine/EngineReadyMessage.d.ts +9 -0
- package/from-engine/HideGuiMessage.d.ts +9 -0
- package/from-engine/KeyDownMessage.d.ts +13 -0
- package/from-engine/PointerEventMessage.d.ts +23 -0
- package/from-engine/SetEffectsSettingsAckMessage.d.ts +14 -0
- package/from-engine/SetLoadingProgressMessage.d.ts +34 -0
- package/package.json +20 -0
- package/post-messages.d.ts +97 -0
- package/to-engine/DownloadScreenshotMessage.d.ts +23 -0
- package/to-engine/HighlightLayerMessage.d.ts +13 -0
- package/to-engine/ResetCameraPositionMessage.d.ts +12 -0
- package/to-engine/RotateToVectorMessage.d.ts +14 -0
- package/to-engine/SelectedEdgesMessage.d.ts +16 -0
- package/to-engine/SetClearColorMessage.d.ts +12 -0
- package/to-engine/SetConnectionInfosMessage.d.ts +21 -0
- package/to-engine/SetCutoutTextureMessage.d.ts +16 -0
- package/to-engine/SetEdgeSelectorEnabledMessage.d.ts +15 -0
- package/to-engine/SetEffectsSettingsMessage.d.ts +110 -0
- package/to-engine/SetEmbossingHeightTextureMessage.d.ts +17 -0
- package/to-engine/SetEnvironmentMessage.d.ts +43 -0
- package/to-engine/SetEnvironmentVisibleMessage.d.ts +13 -0
- package/to-engine/SetGeometryBlobMessage.d.ts +13 -0
- package/to-engine/SetGeometryMessage.d.ts +79 -0
- package/to-engine/SetGeometryUrlMessage.d.ts +13 -0
- package/to-engine/SetGridVisibilityMessage.d.ts +9 -0
- package/to-engine/SetHardwareScalingLevelMessage.d.ts +19 -0
- package/to-engine/SetLayersMessage.d.ts +14 -0
- package/to-engine/SetPpiMessage.d.ts +12 -0
- package/to-engine/SetStageMappingsMessage.d.ts +44 -0
- package/to-engine/SetStageRotationsMessage.d.ts +14 -0
- package/to-engine/SetSurfaceMaterialIdMessage.d.ts +12 -0
- package/to-engine/ToggleFullscreenMessage.d.ts +13 -0
- package/to-engine/ToggleInspectorMessage.d.ts +7 -0
- package/to-engine/ToggleVrMessage.d.ts +12 -0
- package/to-engine/UnhighlightLayerMessage.d.ts +12 -0
package/EngineState.d.ts
ADDED
package/Layer.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 2D layer.
|
|
3
|
+
*/
|
|
4
|
+
export interface Layer {
|
|
5
|
+
/**
|
|
6
|
+
* The oder of the layer. A layer with a higher order overlays a layer with a
|
|
7
|
+
* lower order.
|
|
8
|
+
*
|
|
9
|
+
* Should start at `0`.
|
|
10
|
+
*/
|
|
11
|
+
// TODO: The order should be dynamically set by the engine
|
|
12
|
+
order: number;
|
|
13
|
+
/**
|
|
14
|
+
* The name of the material of the layer (e.g., "print_diffuse").
|
|
15
|
+
*/
|
|
16
|
+
material: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether or not the layer is visible.
|
|
19
|
+
*
|
|
20
|
+
* Defaults to `false`.
|
|
21
|
+
*/
|
|
22
|
+
visible?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A url that points to the texture of the layer.
|
|
25
|
+
*
|
|
26
|
+
* Must be in the PNG format.
|
|
27
|
+
*/
|
|
28
|
+
textureUrl: string | Blob;
|
|
29
|
+
/**
|
|
30
|
+
* Whether or not the layer is overprinted with the texture.
|
|
31
|
+
*
|
|
32
|
+
* Defaults to `false`.
|
|
33
|
+
*/
|
|
34
|
+
overprintContent?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Either the spot color or the tint color, depending on the material used.
|
|
37
|
+
*
|
|
38
|
+
* The color is in HEX format with alpha (e.g., #FF0000FF).
|
|
39
|
+
*/
|
|
40
|
+
overprintColor?: string;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* Overprint mode. Can be either "tint" (for tintable foils) or "opaque" (for
|
|
44
|
+
* spot colors)
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
overprintMode?: "tint" | "opaque";
|
|
48
|
+
/**
|
|
49
|
+
* Whether or not the layer is a cut layer.
|
|
50
|
+
*
|
|
51
|
+
* The cut layer is not rendered by the engine.
|
|
52
|
+
*
|
|
53
|
+
* Defaults to `false`.
|
|
54
|
+
*/
|
|
55
|
+
cut?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether or not the layer is a fold layer.
|
|
58
|
+
*
|
|
59
|
+
* The fold layer is not rendered by the engine.
|
|
60
|
+
*
|
|
61
|
+
* Defaults to `false`.
|
|
62
|
+
*/
|
|
63
|
+
fold?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* A pattern embossing that is applied to the layer.
|
|
66
|
+
*/
|
|
67
|
+
patternEmbossing?: PatternEmbossing;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface PatternEmbossing {
|
|
71
|
+
/**
|
|
72
|
+
* The id of the pattern embossing preset (e.g., "M515_006").
|
|
73
|
+
*/
|
|
74
|
+
preset: string;
|
|
75
|
+
/**
|
|
76
|
+
* Overwrites of the preset values.
|
|
77
|
+
*/
|
|
78
|
+
configuration?: PatternEmbossingConfiguration;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PatternEmbossingConfiguration {
|
|
82
|
+
/**
|
|
83
|
+
* I don't know.
|
|
84
|
+
*/
|
|
85
|
+
overrides?: TextureOverride<unknown>[];
|
|
86
|
+
/**
|
|
87
|
+
* Scaling to scale the pixel size of the embossing to the real physical
|
|
88
|
+
* size.
|
|
89
|
+
*/
|
|
90
|
+
scaling?: [number, number];
|
|
91
|
+
/**
|
|
92
|
+
* The offset of the embossing.
|
|
93
|
+
*/
|
|
94
|
+
offset?: [number, number];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type TextureOverride<T> = Record<
|
|
98
|
+
string,
|
|
99
|
+
Partial<T> | Record<string, Partial<T>>
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
type Texture = unknown;
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Engine Message Types
|
|
2
|
+
|
|
3
|
+
This workspace contains the type definitions for the messages required to
|
|
4
|
+
communicate with the engine.
|
|
5
|
+
|
|
6
|
+
## Adding new messages
|
|
7
|
+
|
|
8
|
+
There are two types of messages:
|
|
9
|
+
|
|
10
|
+
- Messages **to** the engine and
|
|
11
|
+
- Messages **from** the engine.
|
|
12
|
+
|
|
13
|
+
To add a new message, you have to create a new file in the appropriate folder
|
|
14
|
+
(either `/from-engine` or `/to-engine`) with the interface for the new message.
|
|
15
|
+
After creating the interface, you must not forget to add it to the correct union
|
|
16
|
+
(either `FromEnginePostMessage` or `ToEnginePostMessage`) in the
|
|
17
|
+
`post-messages.d.ts` file.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EngineState } from "../EngineState";
|
|
2
|
+
import { FromEngineMessage } from "../post-messages";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sent as a response for every message to the engine,
|
|
6
|
+
*/
|
|
7
|
+
export interface AckMessage extends FromEngineMessage<"ack"> {
|
|
8
|
+
/**
|
|
9
|
+
* The state of the engine.
|
|
10
|
+
*/
|
|
11
|
+
payload: EngineState;
|
|
12
|
+
/**
|
|
13
|
+
* The nonce that was sent with the message to the engine.
|
|
14
|
+
*
|
|
15
|
+
* Used to identify to what message the ack belongs.
|
|
16
|
+
*/
|
|
17
|
+
nonce: string;
|
|
18
|
+
/**
|
|
19
|
+
* An error if the message to the engine could not be processed by the engine.
|
|
20
|
+
*/
|
|
21
|
+
error?: {
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FromEngineMessage, ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A screenshot of the canvas that is sent to the embedder when the heatmap
|
|
5
|
+
* collection is stopped.
|
|
6
|
+
*
|
|
7
|
+
* The screenshot is used by the embedder to draw the heatmap over it.
|
|
8
|
+
*/
|
|
9
|
+
// TODO: This should have another name to make it clear it's related to the
|
|
10
|
+
// heat map collection.
|
|
11
|
+
export interface CanvasImageUrlMessage
|
|
12
|
+
extends FromEngineMessage<"canvas-image-url"> {
|
|
13
|
+
payload: {
|
|
14
|
+
/**
|
|
15
|
+
* The height of the image.
|
|
16
|
+
*/
|
|
17
|
+
height: number;
|
|
18
|
+
/**
|
|
19
|
+
* The width of the image.
|
|
20
|
+
*/
|
|
21
|
+
width: number;
|
|
22
|
+
/**
|
|
23
|
+
* The base64 encoded image in the PNG format.
|
|
24
|
+
*/
|
|
25
|
+
data: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A message that gets send by the engine when it's ready to receive commands.
|
|
5
|
+
* You must not send any messages before receiving this message.
|
|
6
|
+
*/
|
|
7
|
+
export interface EngineReadyMessage extends FromEngineMessage<"engine-ready"> {
|
|
8
|
+
payload: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A message that gets send by the engine when it's showing something that
|
|
5
|
+
* interferes with the GUI, e.g the inspector.
|
|
6
|
+
*/
|
|
7
|
+
export interface HideGuiMessage extends FromEngineMessage<"hide-gui"> {
|
|
8
|
+
payload: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Whenever a key is pressed while the iframe is focused, this event is
|
|
5
|
+
* dispatched. This can be useful since the embedder of the iframe does not
|
|
6
|
+
* receive key down events that happen inside the iframe.
|
|
7
|
+
*/
|
|
8
|
+
export interface KeyDownMessage extends FromEngineMessage<"key-down"> {
|
|
9
|
+
/**
|
|
10
|
+
* The pressed key.
|
|
11
|
+
*/
|
|
12
|
+
payload: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
import { Vector2 } from "@babylonjs/core/Maths/math";
|
|
3
|
+
|
|
4
|
+
// Mouse events from engine to clients
|
|
5
|
+
export interface PointerEvent {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
drag: boolean;
|
|
9
|
+
type: string;
|
|
10
|
+
buttons: number;
|
|
11
|
+
pick?: Vector2;
|
|
12
|
+
shiftKey: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sent when an edge gets deselected.
|
|
17
|
+
*/
|
|
18
|
+
export interface PointerEventMessage extends ToEngineMessage<"pointer-event"> {
|
|
19
|
+
/**
|
|
20
|
+
* The index of the edge.
|
|
21
|
+
*/
|
|
22
|
+
payload: PointerEvent;
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NoUndefinedField } from "../NoUndefinedField";
|
|
2
|
+
import { FromEngineMessage } from "../post-messages";
|
|
3
|
+
import { EffectsSettings } from "../to-engine/SetEffectsSettingsMessage";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sent after updating the effect settings with the new setting values.
|
|
7
|
+
*/
|
|
8
|
+
export interface SetEffectsSettingsAckMessage
|
|
9
|
+
extends FromEngineMessage<"set-effects-settings"> {
|
|
10
|
+
/**
|
|
11
|
+
* The settings.
|
|
12
|
+
*/
|
|
13
|
+
payload: NoUndefinedField<EffectsSettings>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FromEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sent whenever a file os loaded by the engine.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetLoadingProgressMessage
|
|
7
|
+
extends FromEngineMessage<"set-loading-progress"> {
|
|
8
|
+
payload: {
|
|
9
|
+
/**
|
|
10
|
+
* Usually the URL of the file to load.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* The state of the loading progress.
|
|
15
|
+
*/
|
|
16
|
+
state: "Created" | "In progress" | "Done";
|
|
17
|
+
/**
|
|
18
|
+
* The time at which the loading progress was updated.
|
|
19
|
+
*/
|
|
20
|
+
timestamp: number;
|
|
21
|
+
/**
|
|
22
|
+
* The bytes loaded so far.
|
|
23
|
+
*
|
|
24
|
+
* `-1` if an error occured.
|
|
25
|
+
*/
|
|
26
|
+
bytes: number;
|
|
27
|
+
/**
|
|
28
|
+
* The total bytes of the file (or `0` if not known yet).
|
|
29
|
+
*
|
|
30
|
+
* `-1` if an error occured.
|
|
31
|
+
*/
|
|
32
|
+
total: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dreamcomposer/engine-types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "The type definitions for messages from and to the engine",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"private": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"**/*.ts"
|
|
9
|
+
],
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@babylonjs/core": "5.0.0-alpha.58",
|
|
12
|
+
"prettier": "^2.5.1",
|
|
13
|
+
"typescript": "^4.4.4"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"format": "prettier --write .",
|
|
17
|
+
"check-format": "prettier --check ."
|
|
18
|
+
},
|
|
19
|
+
"readme": "# Engine Message Types\n\nThis workspace contains the type definitions for the messages required to\ncommunicate with the engine.\n\n## Adding new messages\n\nThere are two types of messages:\n\n- Messages **to** the engine and\n- Messages **from** the engine.\n\nTo add a new message, you have to create a new file in the appropriate folder\n(either `/from-engine` or `/to-engine`) with the interface for the new message.\nAfter creating the interface, you must not forget to add it to the correct union\n(either `FromEnginePostMessage` or `ToEnginePostMessage`) in the\n`post-messages.d.ts` file.\n"
|
|
20
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { AckMessage } from "./from-engine/AckMessage";
|
|
2
|
+
import { CanvasImageUrlMessage } from "./from-engine/CanvasImageUrlMessage";
|
|
3
|
+
import { EngineReadyMessage } from "./from-engine/EngineReadyMessage";
|
|
4
|
+
import { KeyDownMessage } from "./from-engine/KeyDownMessage";
|
|
5
|
+
import { SetLoadingProgressMessage } from "./from-engine/SetLoadingProgressMessage";
|
|
6
|
+
import { DownloadScreenshotMessage } from "./to-engine/DownloadScreenshotMessage";
|
|
7
|
+
import { HighlightLayerMessage } from "./to-engine/HighlightLayerMessage";
|
|
8
|
+
import { ResetCameraPositionMessage } from "./to-engine/ResetCameraPositionMessage";
|
|
9
|
+
import { RotateToVectorMessage } from "./to-engine/RotateToVectorMessage";
|
|
10
|
+
import { SelectedEdgesMessage } from "./to-engine/SelectedEdgesMessage";
|
|
11
|
+
import { SetClearColorMessage } from "./to-engine/SetClearColorMessage";
|
|
12
|
+
import { SetConnectionInfosMessage } from "./to-engine/SetConnectionInfosMessage";
|
|
13
|
+
import { SetCutoutTextureMessage } from "./to-engine/SetCutoutTextureMessage";
|
|
14
|
+
import { SetEdgeSelectorEnabledMessage } from "./to-engine/SetEdgeSelectorEnabledMessage";
|
|
15
|
+
import { SetEffectsSettingsMessage } from "./to-engine/SetEffectsSettingsMessage";
|
|
16
|
+
import { SetEffectsSettingsAckMessage } from "./from-engine/SetEffectsSettingsAckMessage";
|
|
17
|
+
import { SetEmbossingHeightTextureMessage } from "./to-engine/SetEmbossingHeightTextureMessage";
|
|
18
|
+
import { SetEnvironmentMessage } from "./to-engine/SetEnvironmentMessage";
|
|
19
|
+
import { SetEnvironmentVisibleMessage } from "./to-engine/SetEnvironmentVisibleMessage";
|
|
20
|
+
import { SetGeometryBlobMessage } from "./to-engine/SetGeometryBlobMessage";
|
|
21
|
+
import { SetGeometryMessage } from "./to-engine/SetGeometryMessage";
|
|
22
|
+
import { SetGridVisibilityMessage } from "./to-engine/SetGridVisibilityMessage";
|
|
23
|
+
import { SetHardwareScalingLevelMessage } from "./to-engine/SetHardwareScalingLevelMessage";
|
|
24
|
+
import { SetLayersMessage } from "./to-engine/SetLayersMessage";
|
|
25
|
+
import { SetPpiMessage } from "./to-engine/SetPpiMessage";
|
|
26
|
+
import { SetStageMappingsMessage } from "./to-engine/SetStageMappingsMessage";
|
|
27
|
+
import { SetStageRotationsMessage } from "./to-engine/SetStageRotationsMessage";
|
|
28
|
+
import { SetSurfaceMaterialIdMessage } from "./to-engine/SetSurfaceMaterialIdMessage";
|
|
29
|
+
import { ToggleFullscreenMessage } from "./to-engine/ToggleFullscreenMessage";
|
|
30
|
+
import { ToggleInspectorMessage } from "./to-engine/ToggleInspectorMessage";
|
|
31
|
+
import { UnhighlightLayerMessage } from "./to-engine/UnhighlightLayerMessage";
|
|
32
|
+
import { SetGeometryUrlMessage } from "./to-engine/SetGeometryUrlMessage";
|
|
33
|
+
import { ToggleVrMessage } from "./to-engine/ToggleVrMessage";
|
|
34
|
+
import { PointerEventMessage } from "./from-engine/PointerEventMessage";
|
|
35
|
+
import { HideGuiMessage } from "./from-engine/HideGuiMessage";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A message sent from the engine to the embedder.
|
|
39
|
+
*/
|
|
40
|
+
export interface FromEngineMessage<Channel> {
|
|
41
|
+
channel: Channel;
|
|
42
|
+
payload: unknown;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A message sent from the embedder to the engine.
|
|
47
|
+
*/
|
|
48
|
+
export interface ToEngineMessage<Channel> {
|
|
49
|
+
channel: Channel;
|
|
50
|
+
// /**
|
|
51
|
+
// * The nonce is a randomly generated string that is re-send by the engine in
|
|
52
|
+
// * the ack message.
|
|
53
|
+
// */
|
|
54
|
+
// nonce: string;
|
|
55
|
+
payload?: unknown;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type FromEnginePostMessage =
|
|
59
|
+
| AckMessage
|
|
60
|
+
| CanvasImageUrlMessage
|
|
61
|
+
| EngineReadyMessage
|
|
62
|
+
| HideGuiMessage
|
|
63
|
+
| KeyDownMessage
|
|
64
|
+
| PointerEventMessage
|
|
65
|
+
| SetEffectsSettingsAckMessage
|
|
66
|
+
| SetLoadingProgressMessage;
|
|
67
|
+
|
|
68
|
+
export type ToEnginePostMessage =
|
|
69
|
+
| DownloadScreenshotMessage
|
|
70
|
+
| HighlightLayerMessage
|
|
71
|
+
| ResetCameraPositionMessage
|
|
72
|
+
| RotateToVectorMessage
|
|
73
|
+
| SelectedEdgesMessage
|
|
74
|
+
| SetClearColorMessage
|
|
75
|
+
| SetConnectionInfosMessage
|
|
76
|
+
| SetCutoutTextureMessage
|
|
77
|
+
| SetEdgeSelectorEnabledMessage
|
|
78
|
+
| SetEffectsSettingsMessage
|
|
79
|
+
| SetEmbossingHeightTextureMessage
|
|
80
|
+
| SetEnvironmentMessage
|
|
81
|
+
| SetEnvironmentVisibleMessage
|
|
82
|
+
| SetGeometryBlobMessage
|
|
83
|
+
| SetGeometryMessage
|
|
84
|
+
| SetGeometryUrlMessage
|
|
85
|
+
| SetGridVisibilityMessage
|
|
86
|
+
| SetHardwareScalingLevelMessage
|
|
87
|
+
| SetLayersMessage
|
|
88
|
+
| SetPpiMessage
|
|
89
|
+
| SetStageMappingsMessage
|
|
90
|
+
| SetStageRotationsMessage
|
|
91
|
+
| SetSurfaceMaterialIdMessage
|
|
92
|
+
| ToggleFullscreenMessage
|
|
93
|
+
| ToggleInspectorMessage
|
|
94
|
+
| ToggleVrMessage
|
|
95
|
+
| UnhighlightLayerMessage;
|
|
96
|
+
|
|
97
|
+
export type PostMessage = FromEnginePostMessage | ToEnginePostMessage;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
export interface ScreenshotPayload {
|
|
4
|
+
fileName: string;
|
|
5
|
+
overlayPNG?: ImageBitmap;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Downloads a high-resolution screenshot of the current scene.
|
|
12
|
+
*
|
|
13
|
+
* The download starts automatically once the screenshot has been rendered.
|
|
14
|
+
*
|
|
15
|
+
* TODO: What resolution does the screenshot have? What is the file name?
|
|
16
|
+
*/
|
|
17
|
+
export interface DownloadScreenshotMessage
|
|
18
|
+
extends ToEngineMessage<"download-screenshot"> {
|
|
19
|
+
/**
|
|
20
|
+
* An empty object.
|
|
21
|
+
*/
|
|
22
|
+
payload: ScreenshotPayload;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Highlights the given layer.
|
|
5
|
+
*/
|
|
6
|
+
export interface HighlightLayerMessage
|
|
7
|
+
extends ToEngineMessage<"highlight-layer"> {
|
|
8
|
+
/**
|
|
9
|
+
* The name of the layer to highlight (i.e., the key used in the
|
|
10
|
+
* SetLayerMessage payload).
|
|
11
|
+
*/
|
|
12
|
+
payload: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resets the camera to its initial position.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResetCameraPositionMessage
|
|
7
|
+
extends ToEngineMessage<"reset-camera-position"> {
|
|
8
|
+
/**
|
|
9
|
+
* An empty object.
|
|
10
|
+
*/
|
|
11
|
+
payload: Record<string, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rotates the camera to a given vector.
|
|
5
|
+
*/
|
|
6
|
+
export interface RotateToVectorMessage
|
|
7
|
+
extends ToEngineMessage<"rotate-to-vector"> {
|
|
8
|
+
/**
|
|
9
|
+
* The vector to rotate to.
|
|
10
|
+
*
|
|
11
|
+
* Example: `[0, 0, 1]`
|
|
12
|
+
*/
|
|
13
|
+
payload: [number, number, number];
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Selectes an array of edges.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Where do edges come from? Are they part of the texture?
|
|
7
|
+
*/
|
|
8
|
+
export interface SelectedEdgesMessage
|
|
9
|
+
extends ToEngineMessage<"selected-edges"> {
|
|
10
|
+
/**
|
|
11
|
+
* An array with the index of the edges to select.
|
|
12
|
+
*
|
|
13
|
+
* Example: `[8, 9, 13]`
|
|
14
|
+
*/
|
|
15
|
+
payload: number[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the scene's clear color (i.e., the background color).
|
|
5
|
+
*/
|
|
6
|
+
export interface SetClearColorMessage
|
|
7
|
+
extends ToEngineMessage<"set-clear-color"> {
|
|
8
|
+
/**
|
|
9
|
+
* The clear color in HEX format with alpha (e.g., #AD86A3FF).
|
|
10
|
+
*/
|
|
11
|
+
payload: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the area connection infos for the folding edges.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetConnectionInfosMessage
|
|
7
|
+
extends ToEngineMessage<"set-connection-infos"> {
|
|
8
|
+
/**
|
|
9
|
+
* An array with
|
|
10
|
+
*
|
|
11
|
+
* 1. The id of the source area.
|
|
12
|
+
* 2. The id of the target area.
|
|
13
|
+
* 3. The center of the folding edge as an array in the form [x, y].
|
|
14
|
+
* 4. The normal vector of the folding edge as an array in the form [x, y].
|
|
15
|
+
* 5. The length of the folding edge.
|
|
16
|
+
*/
|
|
17
|
+
payload: ConnectionInfos;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ConnectionInfo = [number, number, number[], number[], number];
|
|
21
|
+
export type ConnectionInfos = Array<ConnectionInfo>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets the cutout mask that is used to render holes the surface texture.
|
|
5
|
+
*
|
|
6
|
+
* The cutout mask is a mask in the PNG format with white and transparent
|
|
7
|
+
* colors.
|
|
8
|
+
*/
|
|
9
|
+
export interface SetCutoutTextureMessage
|
|
10
|
+
extends ToEngineMessage<"set-cutout-texture"> {
|
|
11
|
+
/**
|
|
12
|
+
* The cutout mask in the PNG format or an empty string to reset it (i.e.,
|
|
13
|
+
* setting a texture with no cutouts).
|
|
14
|
+
*/
|
|
15
|
+
payload: Blob | "";
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets whether or not the edge selector should be enabled.
|
|
5
|
+
*
|
|
6
|
+
* When enabled, the edges are visible and when clicked on, a SelectEdgeMessage
|
|
7
|
+
* is received.
|
|
8
|
+
*/
|
|
9
|
+
export interface SetEdgeSelectorEnabledMessage
|
|
10
|
+
extends ToEngineMessage<"set-edge-selector-enabled"> {
|
|
11
|
+
/**
|
|
12
|
+
* Whether or not the edge selector should be enabled.
|
|
13
|
+
*/
|
|
14
|
+
payload: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the effect settings.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetEffectsSettingsMessage
|
|
7
|
+
extends ToEngineMessage<"set-effects-settings"> {
|
|
8
|
+
/**
|
|
9
|
+
* The settings.
|
|
10
|
+
*
|
|
11
|
+
* When a field is not send, it is replaced with the default value for that
|
|
12
|
+
* field, overwriting potential previous changes.
|
|
13
|
+
*/
|
|
14
|
+
payload: EffectsSettings;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface EffectsSettings {
|
|
18
|
+
/**
|
|
19
|
+
* The field of view in radians.
|
|
20
|
+
*
|
|
21
|
+
* Defaults to 0.75 (approx. 43 degrees).
|
|
22
|
+
*/
|
|
23
|
+
fieldOfView?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Whether or not the bloom effect should be enabled.
|
|
26
|
+
*
|
|
27
|
+
* Defaults to `true`.
|
|
28
|
+
*/
|
|
29
|
+
bloomEnabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The bloom threshold. A number between `0` and `1`.
|
|
32
|
+
*
|
|
33
|
+
* Defaults to `0.9`.
|
|
34
|
+
*/
|
|
35
|
+
bloomThreshold?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The bloom weight. A number between `0` and `1`.
|
|
38
|
+
*
|
|
39
|
+
* Defaults to `0.05`.
|
|
40
|
+
*/
|
|
41
|
+
bloomWeight?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Whether or not chromatic aberration should be enabled.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `false`.
|
|
46
|
+
*/
|
|
47
|
+
chromaticAberrationEnabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The amount of chromatic aberration. Can be any positive number but values
|
|
50
|
+
* between `0` and `100` yield the best results.
|
|
51
|
+
*
|
|
52
|
+
* Defaults to `0`.
|
|
53
|
+
*/
|
|
54
|
+
chromaticAberrationAmount?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether or not the grain effect should be enabled.
|
|
57
|
+
*
|
|
58
|
+
* Defaults to `false`.
|
|
59
|
+
*/
|
|
60
|
+
grainEnabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The grain intensity. Can be any positive number but values between `0`
|
|
63
|
+
* and `50` yield the best results.
|
|
64
|
+
*
|
|
65
|
+
* Defaults to `30`.
|
|
66
|
+
*/
|
|
67
|
+
grainIntensity?: number;
|
|
68
|
+
/**
|
|
69
|
+
* The image processing brightness in percent.
|
|
70
|
+
*
|
|
71
|
+
* Defaults to `1`.
|
|
72
|
+
*/
|
|
73
|
+
imageProcessingBrightness?: number;
|
|
74
|
+
/**
|
|
75
|
+
* The image processing contrast.
|
|
76
|
+
*
|
|
77
|
+
* Defaults to `1`.
|
|
78
|
+
*/
|
|
79
|
+
imageProcessingContrast?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Whether or not tone mapping should be enabled.
|
|
82
|
+
*
|
|
83
|
+
* Defaults to `false`.
|
|
84
|
+
*/
|
|
85
|
+
toneMappingEnabled?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Whether or not the vignette effect should be enabled.
|
|
88
|
+
*
|
|
89
|
+
* Defaults to `true`.
|
|
90
|
+
*/
|
|
91
|
+
vignetteEnabled?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The weight of the vingnette.
|
|
94
|
+
*
|
|
95
|
+
* Defaults to `1.5`.
|
|
96
|
+
*/
|
|
97
|
+
vignetteWeight?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Whether or not the image should be sharpened.
|
|
100
|
+
*
|
|
101
|
+
* Defaults to `false`.
|
|
102
|
+
*/
|
|
103
|
+
sharpenEnabled?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The sharpen amount.
|
|
106
|
+
*
|
|
107
|
+
* Defaults to `0.3`.
|
|
108
|
+
*/
|
|
109
|
+
sharpenAmount?: number;
|
|
110
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets the height texture for the embossing.
|
|
5
|
+
*
|
|
6
|
+
* The height texture is a grayscale PNG image that is used to calculate the
|
|
7
|
+
* height of the embossing.
|
|
8
|
+
*/
|
|
9
|
+
export interface SetEmbossingHeightTextureMessage
|
|
10
|
+
extends ToEngineMessage<"set-embossing-height-texture"> {
|
|
11
|
+
/**
|
|
12
|
+
* The height texture as a blob in the PNG format.
|
|
13
|
+
*
|
|
14
|
+
* If set to `undefined`, the height texture is removed.
|
|
15
|
+
*/
|
|
16
|
+
payload: undefined | Blob;
|
|
17
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the environment.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Why is this one called "set-environment" and not "set-environment-url"?
|
|
7
|
+
*/
|
|
8
|
+
export interface SetEnvironmentMessage
|
|
9
|
+
extends ToEngineMessage<"set-environment"> {
|
|
10
|
+
/**
|
|
11
|
+
* Supports all supported formats of BabylonJS. It is recommended to use
|
|
12
|
+
* BabylonJS' own format (either DDS or ENV) for faster loading.
|
|
13
|
+
*/
|
|
14
|
+
payload: Environment;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Environment {
|
|
18
|
+
/**
|
|
19
|
+
* An url to the environment file.
|
|
20
|
+
*
|
|
21
|
+
* When `blobHDR` is set, this field is still necessary to get the extension
|
|
22
|
+
* (i.e., the type) of the HDR but is not loaded from the URL. In this case
|
|
23
|
+
* it can be a name instead of a URL.
|
|
24
|
+
*/
|
|
25
|
+
filenameHDR: string;
|
|
26
|
+
/**
|
|
27
|
+
* The data of the HDR. If set, the data is not loaded from the URL provided
|
|
28
|
+
* with the `filenameHDR` field.
|
|
29
|
+
*/
|
|
30
|
+
blobHDR?: Blob;
|
|
31
|
+
/**
|
|
32
|
+
* The exposure of the HDR.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to `1`.
|
|
35
|
+
*/
|
|
36
|
+
exposureHDR?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The default rotation of the environment in radians.
|
|
39
|
+
*
|
|
40
|
+
* Defaults to `0`.
|
|
41
|
+
*/
|
|
42
|
+
defaultRotation?: number;
|
|
43
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets whether or not the environment is visible.
|
|
5
|
+
*
|
|
6
|
+
* When the environment is not visible, you don't see it directly as the
|
|
7
|
+
* background but it still appears in the reflections and is responsible for
|
|
8
|
+
* the lighting.
|
|
9
|
+
*/
|
|
10
|
+
export interface SetEnvironmentVisibleMessage
|
|
11
|
+
extends ToEngineMessage<"set-environment-visible"> {
|
|
12
|
+
payload: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the scene's geometry's model as a blob.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetGeometryBlobMessage
|
|
7
|
+
extends ToEngineMessage<"set-geometry-blob"> {
|
|
8
|
+
/**
|
|
9
|
+
* The data of the geometry (i.e., the 3D model, for example a box or a
|
|
10
|
+
* bottle) in the GLTF format.
|
|
11
|
+
*/
|
|
12
|
+
payload: Blob;
|
|
13
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the geometry.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetGeometryMessage extends ToEngineMessage<"set-geometry"> {
|
|
7
|
+
payload: {
|
|
8
|
+
/**
|
|
9
|
+
* Sets the default scale of the geometry.
|
|
10
|
+
*/
|
|
11
|
+
defaultScale: [number, number, number];
|
|
12
|
+
/**
|
|
13
|
+
* Whether or not the geometry should automatically scale with the mappings
|
|
14
|
+
* defined by the SetStageMappingsMessage.
|
|
15
|
+
*
|
|
16
|
+
* When `true`, the `axes` field of the stages should be set.
|
|
17
|
+
*/
|
|
18
|
+
scaleWithMapping: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether or not the cutout texture from SetCutoutTextureMessage should be
|
|
21
|
+
* used.
|
|
22
|
+
*/
|
|
23
|
+
useCutoutTexture?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* A list with stages.
|
|
26
|
+
*
|
|
27
|
+
* A stage is an area on the geometry that a texture can be drawn on.
|
|
28
|
+
*/
|
|
29
|
+
stages: {
|
|
30
|
+
/**
|
|
31
|
+
* The name of the stage is the key.
|
|
32
|
+
*/
|
|
33
|
+
[stageName: string]: {
|
|
34
|
+
/**
|
|
35
|
+
* The display name of the stage. Does not need to match the name of the
|
|
36
|
+
* key.
|
|
37
|
+
*/
|
|
38
|
+
// TODO: Maybe better call it displayName to make this distinction clear?
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* The normal vector of the stage. This can for example be used to
|
|
42
|
+
* automatically rotate the geometry to face this stage.
|
|
43
|
+
*
|
|
44
|
+
* Example: `[0, 0, 1]`
|
|
45
|
+
*/
|
|
46
|
+
// TODO: Remove.
|
|
47
|
+
normalVector: [number, number, number];
|
|
48
|
+
/**
|
|
49
|
+
* Not neccessary anymore must must still be send.
|
|
50
|
+
*/
|
|
51
|
+
// TODO: Remove
|
|
52
|
+
tris: [];
|
|
53
|
+
/**
|
|
54
|
+
* The UV color of the stage.
|
|
55
|
+
*
|
|
56
|
+
* The UV color marks the area on the texture that the stage is drawn
|
|
57
|
+
* on. The array are normalized RGB colors (i.e., in the range from 0 to
|
|
58
|
+
* 1).
|
|
59
|
+
*
|
|
60
|
+
* Example: `[0.21586, 1, 0.21586]`
|
|
61
|
+
*/
|
|
62
|
+
uvColor: [number, number, number];
|
|
63
|
+
/**
|
|
64
|
+
* Maps the 2 axes of the 2D stage to the axes of the 3D geometry.
|
|
65
|
+
*
|
|
66
|
+
* Only relevant when `scaleWithMapping` is `true`.
|
|
67
|
+
*
|
|
68
|
+
* The number is the number of the axis (i.e., `0` for the x-axis, `1`
|
|
69
|
+
* for the y-axis, and `2` for the z-axis).
|
|
70
|
+
*
|
|
71
|
+
* Example: `[0, 1]` maps the width and height of the stage to the x and
|
|
72
|
+
* y-axis of the geometry.
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
axes?: [number, number];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the url of the scene's geometry's model.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetGeometryUrlMessage
|
|
7
|
+
extends ToEngineMessage<"set-geometry-url"> {
|
|
8
|
+
/**
|
|
9
|
+
* A url to the geometry (i.e., the 3D model, for example a box or a bottle)
|
|
10
|
+
* in the GLTF format.
|
|
11
|
+
*/
|
|
12
|
+
payload: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets the hardware scaling level.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetHardwareScalingLevelMessage
|
|
7
|
+
extends ToEngineMessage<"set-hardware-scaling-level"> {
|
|
8
|
+
/**
|
|
9
|
+
* The hardware scaling level.
|
|
10
|
+
*
|
|
11
|
+
* A smaller value means a higher quality, a larger value means a lower
|
|
12
|
+
* quality.
|
|
13
|
+
*
|
|
14
|
+
* The default value is `1` which means no scaling. If the value is for
|
|
15
|
+
* example `0.5`, the image will be rendered with twice the screen resolution,
|
|
16
|
+
* resulting in a higher quality image.
|
|
17
|
+
*/
|
|
18
|
+
payload: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Layer } from "../Layer";
|
|
2
|
+
import { ToEngineMessage } from "../post-messages";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A message to set the scene's layers.
|
|
6
|
+
*/
|
|
7
|
+
export interface SetLayersMessage extends ToEngineMessage<"set-layers"> {
|
|
8
|
+
payload: {
|
|
9
|
+
/**
|
|
10
|
+
* The layers. The key is the id of the layer.
|
|
11
|
+
*/
|
|
12
|
+
[layerName: string]: Layer;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Set the ppi.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetPpiMessage extends ToEngineMessage<"set-ppi"> {
|
|
7
|
+
/**
|
|
8
|
+
* The PPI. The PPI value is required to properly render textures that have a
|
|
9
|
+
* fixed size (e.g., a micro-embossing with a 5x5mm pattern).
|
|
10
|
+
*/
|
|
11
|
+
payload: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A message to set the stage mappings (i.e., how a texture is mapped to the
|
|
5
|
+
* geometry).
|
|
6
|
+
*/
|
|
7
|
+
export interface SetStageMappingsMessage
|
|
8
|
+
extends ToEngineMessage<"set-stage-mappings"> {
|
|
9
|
+
payload: {
|
|
10
|
+
/**
|
|
11
|
+
* The name of the stage is the key and defined in the SetGeometryMessage.
|
|
12
|
+
*/
|
|
13
|
+
[stageName: string]: {
|
|
14
|
+
/**
|
|
15
|
+
* The x position where the mapping begings.
|
|
16
|
+
*
|
|
17
|
+
* This is not a pixel value but a percentage (i.e., a value between `0`
|
|
18
|
+
* and `1`).
|
|
19
|
+
*/
|
|
20
|
+
x: number;
|
|
21
|
+
/**
|
|
22
|
+
* The y position where the mapping begings.
|
|
23
|
+
*
|
|
24
|
+
* This is not a pixel value but a percentage (i.e., a value between `0`
|
|
25
|
+
* and `1`).
|
|
26
|
+
*/
|
|
27
|
+
y: number;
|
|
28
|
+
/**
|
|
29
|
+
* The with of the mapping.
|
|
30
|
+
*
|
|
31
|
+
* This is not a pixel value but a percentage (i.e., a value between `0`
|
|
32
|
+
* and `1`).
|
|
33
|
+
*/
|
|
34
|
+
width: number;
|
|
35
|
+
/**
|
|
36
|
+
* The height of the mapping.
|
|
37
|
+
*
|
|
38
|
+
* This is not a pixel value but a percentage (i.e., a value between `0`
|
|
39
|
+
* and `1`).
|
|
40
|
+
*/
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets how the engine should rotate the stages.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetStageRotationsMessage
|
|
7
|
+
extends ToEngineMessage<"set-stage-rotations"> {
|
|
8
|
+
payload: {
|
|
9
|
+
/**
|
|
10
|
+
* The name of the stage with its rotation in degrees.
|
|
11
|
+
*/
|
|
12
|
+
[stageName: string]: 0 | 90 | 180 | 270;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Loads and sets the surface material by its id.
|
|
5
|
+
*/
|
|
6
|
+
export interface SetSurfaceMaterialIdMessage
|
|
7
|
+
extends ToEngineMessage<"set-surface-material-id"> {
|
|
8
|
+
/**
|
|
9
|
+
* The id of the surface material (e.g., "paper_blanko_rough").
|
|
10
|
+
*/
|
|
11
|
+
payload: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Toggles whether or not the iframe should be fullscreen.
|
|
5
|
+
*/
|
|
6
|
+
export interface ToggleFullscreenMessage
|
|
7
|
+
extends ToEngineMessage<"toggle-fullscreen"> {
|
|
8
|
+
/**
|
|
9
|
+
* An empty object.
|
|
10
|
+
*/
|
|
11
|
+
// TODO: Add way to explicitly set it (i.e., a boolean)
|
|
12
|
+
payload: Record<string, never>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Toggles VR.
|
|
5
|
+
*/
|
|
6
|
+
export interface ToggleVrMessage extends ToEngineMessage<"toggle-vr"> {
|
|
7
|
+
/**
|
|
8
|
+
* An empty object.
|
|
9
|
+
*/
|
|
10
|
+
// TODO: Add way to explicitly set it (i.e., a boolean)
|
|
11
|
+
payload: Record<string, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToEngineMessage } from "../post-messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Removes previously highlighting of a layer.
|
|
5
|
+
*/
|
|
6
|
+
export interface UnhighlightLayerMessage
|
|
7
|
+
extends ToEngineMessage<"unhighlight-layer"> {
|
|
8
|
+
/**
|
|
9
|
+
* The name of the layer to remove highlighting.
|
|
10
|
+
*/
|
|
11
|
+
payload: string;
|
|
12
|
+
}
|