@3dverse/livelink.core 0.2.0 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  import { RTID, UUID } from "../sources/types";
2
2
  import { EntityInterface } from "../sources/interfaces/EntityInterface";
3
- import { ConnectConfirmation, EditorEntity, EntityCreationOptions, EntityUpdatedEvent, UpdateEntitiesCommand } from "./messages/editor";
3
+ import { ConnectConfirmation, EditorEntity, EntityCreationOptions, EntityUpdatedEvent, UpdateComponentsCommand } from "./messages/editor";
4
4
  /**
5
5
  * This follows the Livelink protocol specifications for the broker messages.
6
6
  */
@@ -39,7 +39,7 @@ export declare class EditorMessageHandler extends EventTarget {
39
39
  /**
40
40
  *
41
41
  */
42
- updateComponents(data: UpdateEntitiesCommand): void;
42
+ updateComponents(data: UpdateComponentsCommand): void;
43
43
  /**
44
44
  *
45
45
  */
@@ -82,7 +82,7 @@ export declare class EditorMessageHandler extends EventTarget {
82
82
  on_entity_reparented(data: any): void;
83
83
  deleteEntities({ entity_uuids }: {
84
84
  entity_uuids: Array<UUID>;
85
- }): Promise<string[]> | undefined;
85
+ }): Promise<Array<UUID>>;
86
86
  on_entities_deleted(data: Array<UUID>): void;
87
87
  on_animation_sequence_instance_added(data: any): void;
88
88
  on_animation_sequence_instance_updated(data: any): void;
@@ -3,7 +3,7 @@
3
3
  * This file has been generated automatically from its AsyncAPI spec file.
4
4
  * See : https://gitlab.com/3dverse/platform/libs/js/asyncapi-server-generator
5
5
  */
6
- import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SessionAuth, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "./messages/gateway";
6
+ import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SkeletonPoseMessage, SessionAuth, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "./messages/gateway";
7
7
  import { UUID, Vec2ui16 } from "../sources/types";
8
8
  /**
9
9
  * Message handlers interface.
@@ -22,7 +22,7 @@ export declare class GatewayMessageHandler extends EventTarget {
22
22
  */
23
23
  protected _disconnect(): void;
24
24
  /***************************************************************************
25
- * AUTHENTICATION
25
+ * AUTHENTICATION (0)
26
26
  **************************************************************************/
27
27
  /**
28
28
  * Request
@@ -37,7 +37,7 @@ export declare class GatewayMessageHandler extends EventTarget {
37
37
  data_view: DataView;
38
38
  }): void;
39
39
  /***************************************************************************
40
- * HEARTBEAT
40
+ * HEARTBEAT (11)
41
41
  **************************************************************************/
42
42
  /**
43
43
  * Request
@@ -48,14 +48,12 @@ export declare class GatewayMessageHandler extends EventTarget {
48
48
  */
49
49
  _on_pulseHeartbeat_response(): void;
50
50
  /***************************************************************************
51
- * REGISTRATION
51
+ * REGISTRATION (1)
52
52
  **************************************************************************/
53
53
  /**
54
54
  * Request
55
55
  */
56
- configureClient({ client_config }: {
57
- client_config: ClientConfig;
58
- }): Promise<ClientConfigResponse>;
56
+ configureClient(client_config: ClientConfig): Promise<ClientConfigResponse>;
59
57
  /**
60
58
  * Reply
61
59
  */
@@ -63,7 +61,23 @@ export declare class GatewayMessageHandler extends EventTarget {
63
61
  data_view: DataView;
64
62
  }): void;
65
63
  /***************************************************************************
66
- * VIEWER CONTROL
64
+ * INPUTS (2)
65
+ **************************************************************************/
66
+ /**
67
+ * Send
68
+ */
69
+ sendInputState(input_state: InputState): void;
70
+ /***************************************************************************
71
+ * VIDEO STREAM (3)
72
+ **************************************************************************/
73
+ /**
74
+ * Receive
75
+ */
76
+ _onFrameReceived({ data_view }: {
77
+ data_view: DataView;
78
+ }): void;
79
+ /***************************************************************************
80
+ * VIEWER CONTROL (4)
67
81
  **************************************************************************/
68
82
  /**
69
83
  * Send
@@ -92,47 +106,16 @@ export declare class GatewayMessageHandler extends EventTarget {
92
106
  data_view: DataView;
93
107
  }): void;
94
108
  /***************************************************************************
95
- * INPUTS
96
- **************************************************************************/
97
- /**
98
- * Send
99
- */
100
- sendInputState({ input_state }: {
101
- input_state: InputState;
102
- }): void;
103
- /***************************************************************************
104
- * VIDEO STREAM
105
- **************************************************************************/
106
- /**
107
- * Receive
108
- */
109
- _onFrameReceived({ data_view }: {
110
- data_view: DataView;
111
- }): void;
112
- /***************************************************************************
113
- * SCRIPT EVENTS
114
- **************************************************************************/
115
- /**
116
- * Receive
117
- */
118
- _onScriptEventReceived({ data_view }: {
119
- data_view: DataView;
120
- }): void;
121
- /***************************************************************************
122
- * CLIENT REMOTE OPERATIONS
109
+ * CLIENT REMOTE OPERATIONS (5)
123
110
  **************************************************************************/
124
111
  /**
125
112
  * Request
126
113
  */
127
- castScreenSpaceRay({ screenSpaceRayQuery, }: {
128
- screenSpaceRayQuery: ScreenSpaceRayQuery;
129
- }): Promise<ScreenSpaceRayResult>;
114
+ castScreenSpaceRay(screenSpaceRayQuery: ScreenSpaceRayQuery): Promise<ScreenSpaceRayResult>;
130
115
  /**
131
116
  * Send
132
117
  */
133
- highlightEntities({ highlightEntitiesMessage }: {
134
- highlightEntitiesMessage: HighlightEntitiesMessage;
135
- }): void;
118
+ highlightEntities(highlightEntitiesMessage: HighlightEntitiesMessage): void;
136
119
  /**
137
120
  * Reply
138
121
  */
@@ -143,36 +126,39 @@ export declare class GatewayMessageHandler extends EventTarget {
143
126
  data_view: DataView;
144
127
  }): void;
145
128
  /***************************************************************************
146
- * EDITOR REMOTE OPERATIONS
129
+ * EDITOR REMOTE OPERATIONS (6)
147
130
  **************************************************************************/
148
131
  /**
149
132
  * Send
150
133
  */
151
- fireEvent({ fireEventMessage }: {
152
- fireEventMessage: FireEventMessage;
153
- }): void;
134
+ fireEvent(fireEventMessage: FireEventMessage): void;
154
135
  /**
155
136
  * Send
156
137
  */
157
- updateAnimationSequenceState({ updateAnimationSequenceStateMessage, }: {
158
- updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage;
159
- }): void;
138
+ sendSkeletonPose(sendSkeletonPoseMessage: SkeletonPoseMessage): void;
160
139
  /**
161
140
  * Send
162
141
  */
163
- assignClientToScript({ assignClientToScriptMessage, }: {
164
- assignClientToScriptMessage: AssignClientToScriptMessage;
165
- }): void;
142
+ updateAnimationSequenceState(updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage): void;
166
143
  /**
167
144
  * Send
168
145
  */
169
- updateEntities({ updateEntitiesFromJsonMessage, }: {
170
- updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage;
171
- }): void;
146
+ assignClientToScript(assignClientToScriptMessage: AssignClientToScriptMessage): void;
147
+ /**
148
+ * Send
149
+ */
150
+ updateEntitiesFromJson(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
172
151
  /**
173
152
  * Send
174
153
  */
175
- removeComponents({ removeComponentsCommand }: {
176
- removeComponentsCommand: RemoveComponentsCommand;
154
+ removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
155
+ /***************************************************************************
156
+ * SCRIPT EVENTS (14)
157
+ **************************************************************************/
158
+ /**
159
+ * Receive
160
+ */
161
+ _onScriptEventReceived({ data_view }: {
162
+ data_view: DataView;
177
163
  }): void;
178
164
  }
@@ -3,4 +3,4 @@ import type { ComponentType } from "../../types/components";
3
3
  /**
4
4
  *
5
5
  */
6
- export type UpdateEntitiesCommand = Record<UUID, Record<ComponentType, {}> | {}>;
6
+ export type UpdateComponentsCommand = Record<UUID, Record<ComponentType, {}>>;
@@ -0,0 +1,20 @@
1
+ import { RTID, Quat } from "../../../sources/types";
2
+ /**
3
+ *
4
+ */
5
+ export type SkeletonPoseMessage = {
6
+ controller_rtid: RTID;
7
+ pose: Map<number, Quat>;
8
+ };
9
+ /**
10
+ *
11
+ */
12
+ export declare function compute_SkeletonPoseMessage_size(skeletonPoseMessage: SkeletonPoseMessage): number;
13
+ /**
14
+ *
15
+ */
16
+ export declare function serialize_SkeletonPoseMessage({ data_view, offset, skeletonPoseMessage, }: {
17
+ data_view: DataView;
18
+ offset?: number;
19
+ skeletonPoseMessage: SkeletonPoseMessage;
20
+ }): number;
@@ -115,5 +115,6 @@ export declare enum EditorRemoteOperation {
115
115
  assign_client_uuid_to_script = 20,
116
116
  update_animation_sequence_instance = 21,
117
117
  remove_animation_sequence_instance = 22,
118
- update_animation_sequence_state = 23
118
+ update_animation_sequence_state = 23,
119
+ send_skeleton_pose = 24
119
120
  }
@@ -11,6 +11,7 @@ export * from "./ResizeResponse";
11
11
  export * from "./ScreenSpaceRayQuery";
12
12
  export * from "./ScreenSpaceRayResult";
13
13
  export * from "./ScriptEvent";
14
+ export * from "./SendSkeletonPoseMessage";
14
15
  export * from "./SessionAuth";
15
16
  export * from "./UpdateAnimationSequenceStateMessage";
16
17
  export * from "./UpdateEntitiesFromJsonMessage";
@@ -1,9 +1,9 @@
1
- import type { ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ScreenSpaceRayQuery, ScreenSpaceRayResult, UpdateEntitiesFromJsonMessage, ViewportConfig } from "../_prebuild/messages/gateway";
1
+ import type { AssignClientToScriptMessage, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ScreenSpaceRayQuery, ScreenSpaceRayResult, SkeletonPoseMessage, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "../_prebuild/messages/gateway";
2
2
  import { ComponentSerializer } from "./ComponentSerializer";
3
3
  import { RTID, UUID, Vec2i } from "./types";
4
4
  import { EntityInterface } from "./interfaces/EntityInterface";
5
5
  import { SessionInterface } from "./interfaces/SessionInterface";
6
- import { EditorEntity, EntityCreationOptions, UpdateEntitiesCommand } from "../_prebuild/messages/editor";
6
+ import { EditorEntity, EntityCreationOptions, UpdateComponentsCommand } from "../_prebuild/messages/editor";
7
7
  /**
8
8
  * The LivelinkCore interface.
9
9
  *
@@ -15,23 +15,23 @@ import { EditorEntity, EntityCreationOptions, UpdateEntitiesCommand } from "../_
15
15
  * interface, allowing for interface evolution without breaking compatibility with existing
16
16
  * applications.
17
17
  */
18
- export declare class LivelinkCore extends EventTarget {
18
+ export declare class LivelinkCore {
19
19
  #private;
20
20
  /**
21
21
  * Connect to the session
22
22
  */
23
- _connect({ session, editor_url, }: {
23
+ connect({ session, editor_url, }: {
24
24
  session: SessionInterface;
25
25
  editor_url: string;
26
26
  }): Promise<ComponentSerializer>;
27
27
  /**
28
28
  * Closes the connections to the gateway and the editor.
29
29
  */
30
- _disconnect(): Promise<void>;
30
+ disconnect(): void;
31
31
  /**
32
32
  *
33
33
  */
34
- _addEventListener({ target, event_name, handler, }: {
34
+ addEventListener({ target, event_name, handler, }: {
35
35
  target: "gateway" | "editor";
36
36
  event_name: string;
37
37
  handler: EventListenerOrEventListenerObject;
@@ -39,122 +39,139 @@ export declare class LivelinkCore extends EventTarget {
39
39
  /**
40
40
  *
41
41
  */
42
- _removeEventListener({ target, event_name, handler, }: {
42
+ removeEventListener({ target, event_name, handler, }: {
43
43
  target: "gateway" | "editor";
44
44
  event_name: string;
45
45
  handler: EventListenerOrEventListenerObject;
46
46
  }): void;
47
+ /***************************************************************************
48
+ * REGISTRATION (1)
49
+ **************************************************************************/
47
50
  /**
48
51
  * Send the configuration requested by the client.
49
52
  */
50
53
  configureClient({ client_config }: {
51
54
  client_config: ClientConfig;
52
55
  }): Promise<ClientConfigResponse>;
56
+ /***************************************************************************
57
+ * INPUTS (2)
58
+ **************************************************************************/
53
59
  /**
54
60
  *
55
61
  */
56
- _resize({ size }: {
57
- size: Vec2i;
62
+ sendInputState({ input_state }: {
63
+ input_state: InputState;
58
64
  }): void;
65
+ /***************************************************************************
66
+ * VIEWER CONTROL (4)
67
+ **************************************************************************/
59
68
  /**
60
69
  *
61
70
  */
62
- _castScreenSpaceRay({ screenSpaceRayQuery, }: {
63
- screenSpaceRayQuery: ScreenSpaceRayQuery;
64
- }): Promise<ScreenSpaceRayResult>;
71
+ resize({ size }: {
72
+ size: Vec2i;
73
+ }): void;
65
74
  /**
66
75
  *
67
76
  */
68
- highlightEntities({ highlightEntitiesMessage }: {
69
- highlightEntitiesMessage: HighlightEntitiesMessage;
70
- }): void;
77
+ suspend(): void;
71
78
  /**
72
79
  *
73
80
  */
74
- fireEvent(fireEventMessage: FireEventMessage): void;
81
+ resume(): void;
75
82
  /**
76
83
  *
77
84
  */
78
- _spawnEntity({ entity, options, }: {
79
- entity: EntityInterface;
80
- options?: EntityCreationOptions;
81
- }): Promise<EditorEntity>;
85
+ setViewports({ viewports }: {
86
+ viewports: Array<ViewportConfig>;
87
+ }): void;
88
+ /***************************************************************************
89
+ * CLIENT REMOTE OPERATIONS (5)
90
+ **************************************************************************/
82
91
  /**
83
92
  *
84
93
  */
85
- _deleteEntities({ entity_uuids }: {
86
- entity_uuids: Array<UUID>;
87
- }): Promise<void>;
94
+ castScreenSpaceRay({ screenSpaceRayQuery, }: {
95
+ screenSpaceRayQuery: ScreenSpaceRayQuery;
96
+ }): Promise<ScreenSpaceRayResult>;
88
97
  /**
89
98
  *
90
99
  */
91
- _findEntitiesByEUID({ entity_uuid }: {
92
- entity_uuid: UUID;
93
- }): Promise<Array<EditorEntity>>;
100
+ highlightEntities({ highlightEntitiesMessage }: {
101
+ highlightEntitiesMessage: HighlightEntitiesMessage;
102
+ }): void;
103
+ /***************************************************************************
104
+ * EDITOR REMOTE OPERATIONS (6)
105
+ **************************************************************************/
94
106
  /**
95
- *
107
+ * 4
96
108
  */
97
- _resolveAncestors({ entity_rtid }: {
98
- entity_rtid: RTID;
99
- }): Promise<Array<EditorEntity>>;
109
+ removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
100
110
  /**
101
- *
111
+ * 11
102
112
  */
103
- _getChildren({ entity_rtid }: {
104
- entity_rtid: RTID;
105
- }): Promise<Array<EditorEntity>>;
113
+ fireEvent(fireEventMessage: FireEventMessage): void;
106
114
  /**
107
- *
115
+ * 15
108
116
  */
109
- _sendInput({ input_state }: {
110
- input_state: InputState;
111
- }): void;
117
+ updateEntitiesFromJson(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
112
118
  /**
113
- *
119
+ * 20
114
120
  */
115
- _updateAnimationSequenceState(params: {
116
- linker_rtid: RTID;
117
- animation_sequence_id: UUID;
118
- state: 1 | 0;
119
- playback_speed: number;
120
- seek_offset?: number;
121
- }): void;
121
+ assignClientToScript(assignClientToScriptMessage: AssignClientToScriptMessage): void;
122
122
  /**
123
- *
123
+ * 23
124
124
  */
125
- assignClientToScript({ client_uuid, script_uuid, entity_rtid, }: {
126
- client_uuid: UUID;
127
- script_uuid: UUID;
128
- entity_rtid: RTID;
129
- }): void;
125
+ updateAnimationSequenceState(updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage): void;
126
+ /**
127
+ * 24
128
+ */
129
+ sendSkeletonPose(skeletonPoseMessage: SkeletonPoseMessage): void;
130
+ /***************************************************************************
131
+ * EDITOR
132
+ **************************************************************************/
130
133
  /**
131
134
  *
132
135
  */
133
- _setViewports({ viewports }: {
134
- viewports: Array<ViewportConfig>;
135
- }): void;
136
+ spawnEntity({ entity, options, }: {
137
+ entity: EntityInterface;
138
+ options?: EntityCreationOptions;
139
+ }): Promise<EditorEntity>;
136
140
  /**
137
141
  *
138
142
  */
139
- resume(): void;
143
+ updateComponents(updateEntitiesCommand: UpdateComponentsCommand): void;
140
144
  /**
141
145
  *
142
146
  */
143
- suspend(): void;
147
+ deleteEntities({ entity_uuids }: {
148
+ entity_uuids: Array<UUID>;
149
+ }): Promise<void>;
144
150
  /**
145
151
  *
146
152
  */
147
- startSimulation(): void;
153
+ findEntitiesByEUID({ entity_uuid }: {
154
+ entity_uuid: UUID;
155
+ }): Promise<Array<EditorEntity>>;
148
156
  /**
149
157
  *
150
158
  */
151
- _updateEntities(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
159
+ resolveAncestors({ entity_rtid }: {
160
+ entity_rtid: RTID;
161
+ }): Promise<Array<EditorEntity>>;
152
162
  /**
153
163
  *
154
164
  */
155
- _updateComponents(updateEntitiesCommand: UpdateEntitiesCommand): void;
165
+ getChildren({ entity_rtid }: {
166
+ entity_rtid: RTID;
167
+ }): Promise<Array<EditorEntity>>;
168
+ /***************************************************************************
169
+ * Utils
170
+ **************************************************************************/
156
171
  /**
157
172
  *
158
173
  */
159
- _removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
174
+ setSimulationState({ state }: {
175
+ state: "start_simulation" | "pause_simulation" | "stop_simulation";
176
+ }): void;
160
177
  }
@@ -55,6 +55,15 @@ export declare function deserialize_Vec2ui16({ data_view, offset }: {
55
55
  *
56
56
  */
57
57
  export type Quat = [number, number, number, number];
58
+ export declare const QUAT_BYTE_SIZE: 16;
59
+ /**
60
+ *
61
+ */
62
+ export declare function serialize_Quat({ data_view, offset, q }: {
63
+ data_view: DataView;
64
+ offset: number;
65
+ q: Quat;
66
+ }): number;
58
67
  /**
59
68
  *
60
69
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dverse/livelink.core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "3dverse Livelink Core types.",
5
5
  "main": "./dist/library.cjs",
6
6
  "module": "./dist/library.mjs",