@dcl/protocol 1.0.0-10955038136.commit-7fe9554 → 1.0.0-11502421172.commit-b32f4af

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.
Files changed (62) hide show
  1. package/out-js/decentraland/common/texture.gen.d.ts +18 -0
  2. package/out-js/decentraland/common/texture.gen.js +104 -4
  3. package/out-js/decentraland/common/texture.gen.js.map +1 -1
  4. package/out-js/decentraland/sdk/components/avatar_modifier_area.gen.d.ts +41 -0
  5. package/out-js/decentraland/sdk/components/avatar_modifier_area.gen.js +241 -3
  6. package/out-js/decentraland/sdk/components/avatar_modifier_area.gen.js.map +1 -1
  7. package/out-js/decentraland/sdk/components/camera_mode_area.gen.d.ts +35 -1
  8. package/out-js/decentraland/sdk/components/camera_mode_area.gen.js +172 -3
  9. package/out-js/decentraland/sdk/components/camera_mode_area.gen.js.map +1 -1
  10. package/out-js/decentraland/sdk/components/gltf_container_loading_state.gen.d.ts +19 -0
  11. package/out-js/decentraland/sdk/components/gltf_container_loading_state.gen.js +90 -3
  12. package/out-js/decentraland/sdk/components/gltf_container_loading_state.gen.js.map +1 -1
  13. package/out-js/decentraland/sdk/components/gltf_node.gen.d.ts +66 -0
  14. package/out-js/decentraland/sdk/components/gltf_node.gen.js +69 -0
  15. package/out-js/decentraland/sdk/components/gltf_node.gen.js.map +1 -0
  16. package/out-js/decentraland/sdk/components/gltf_node_state.gen.d.ts +43 -0
  17. package/out-js/decentraland/sdk/components/gltf_node_state.gen.js +122 -0
  18. package/out-js/decentraland/sdk/components/gltf_node_state.gen.js.map +1 -0
  19. package/out-js/decentraland/sdk/components/material.gen.d.ts +23 -1
  20. package/out-js/decentraland/sdk/components/material.gen.js +108 -3
  21. package/out-js/decentraland/sdk/components/material.gen.js.map +1 -1
  22. package/out-js/decentraland/sdk/components/mesh_collider.gen.d.ts +18 -0
  23. package/out-js/decentraland/sdk/components/mesh_collider.gen.js +90 -4
  24. package/out-js/decentraland/sdk/components/mesh_collider.gen.js.map +1 -1
  25. package/out-js/decentraland/sdk/components/mesh_renderer.gen.d.ts +19 -3
  26. package/out-js/decentraland/sdk/components/mesh_renderer.gen.js +90 -4
  27. package/out-js/decentraland/sdk/components/mesh_renderer.gen.js.map +1 -1
  28. package/out-js/decentraland/sdk/components/ui_text.gen.d.ts +4 -0
  29. package/out-js/decentraland/sdk/components/ui_text.gen.js +30 -1
  30. package/out-js/decentraland/sdk/components/ui_text.gen.js.map +1 -1
  31. package/out-js/decentraland/sdk/components/ui_transform.gen.d.ts +35 -0
  32. package/out-js/decentraland/sdk/components/ui_transform.gen.js +188 -2
  33. package/out-js/decentraland/sdk/components/ui_transform.gen.js.map +1 -1
  34. package/out-ts/decentraland/common/texture.gen.ts +119 -4
  35. package/out-ts/decentraland/sdk/components/avatar_modifier_area.gen.ts +292 -1
  36. package/out-ts/decentraland/sdk/components/camera_mode_area.gen.ts +218 -2
  37. package/out-ts/decentraland/sdk/components/gltf_container_loading_state.gen.ts +108 -2
  38. package/out-ts/decentraland/sdk/components/gltf_node.gen.ts +116 -0
  39. package/out-ts/decentraland/sdk/components/gltf_node_state.gen.ts +139 -0
  40. package/out-ts/decentraland/sdk/components/material.gen.ts +131 -4
  41. package/out-ts/decentraland/sdk/components/mesh_collider.gen.ts +99 -0
  42. package/out-ts/decentraland/sdk/components/mesh_renderer.gen.ts +100 -3
  43. package/out-ts/decentraland/sdk/components/ui_text.gen.ts +40 -1
  44. package/out-ts/decentraland/sdk/components/ui_transform.gen.ts +212 -1
  45. package/package.json +2 -2
  46. package/proto/decentraland/common/texture.proto +8 -1
  47. package/proto/decentraland/sdk/components/avatar_modifier_area.proto +21 -0
  48. package/proto/decentraland/sdk/components/camera_mode_area.proto +22 -3
  49. package/proto/decentraland/sdk/components/global_light.proto +22 -0
  50. package/proto/decentraland/sdk/components/gltf_container_loading_state.proto +13 -0
  51. package/proto/decentraland/sdk/components/gltf_node.proto +42 -0
  52. package/proto/decentraland/sdk/components/gltf_node_state.proto +20 -0
  53. package/proto/decentraland/sdk/components/light.proto +42 -0
  54. package/proto/decentraland/sdk/components/material.proto +13 -1
  55. package/proto/decentraland/sdk/components/mesh_collider.proto +8 -1
  56. package/proto/decentraland/sdk/components/mesh_renderer.proto +8 -3
  57. package/proto/decentraland/sdk/components/spotlight.proto +21 -0
  58. package/proto/decentraland/sdk/components/ui_canvas.proto +16 -0
  59. package/proto/decentraland/sdk/components/ui_scroll_result.proto +12 -0
  60. package/proto/decentraland/sdk/components/ui_text.proto +3 -0
  61. package/proto/decentraland/sdk/components/ui_transform.proto +21 -0
  62. package/public/sdk-components.proto +2 -0
@@ -7,7 +7,7 @@ export const protobufPackage = "decentraland.sdk.components";
7
7
 
8
8
  /**
9
9
  * The CameraModeArea component can be attached to an Entity to define a region of space where
10
- * the player's camera mode (1st-person or 3rd-person) is overridden.
10
+ * the player's camera mode (1st-person, 3rd-person or cinematic) is overridden.
11
11
  *
12
12
  * The Entity's Transform position determines the center-point of the region, while its size is
13
13
  * given as a vector in the `area` property below. The Transform rotation is applied, but the scale
@@ -17,6 +17,8 @@ export const protobufPackage = "decentraland.sdk.components";
17
17
  *
18
18
  * Note that, while commonly used to delineate a 2D area in a scene (hence the name), the region
19
19
  * is actually a 3D volume.
20
+ *
21
+ * When mode is set to CtCinematic, the cinematic_settings field must also be provided.
20
22
  */
21
23
  export interface PBCameraModeArea {
22
24
  /** the 3D size of the region */
@@ -25,10 +27,47 @@ export interface PBCameraModeArea {
25
27
  | undefined;
26
28
  /** the camera mode to enforce */
27
29
  mode: CameraType;
30
+ cinematicSettings?:
31
+ | CinematicSettings
32
+ | undefined;
33
+ /** if true, the player will be considered inside the area when they are within 0.3m of the area. default true */
34
+ useColliderRange?: boolean | undefined;
35
+ }
36
+
37
+ export interface CinematicSettings {
38
+ /** Entity that defines the cinematic camera transform. */
39
+ cameraEntity: number;
40
+ /**
41
+ * Position -> camera's position
42
+ * Rotation -> camera's direction
43
+ * scale.z -> zoom level
44
+ * scale.x and scale.y -> unused
45
+ */
46
+ allowManualRotation?:
47
+ | boolean
48
+ | undefined;
49
+ /** how far the camera can rotate around the y-axis / look left/right, in radians. default unrestricted */
50
+ yawRange?:
51
+ | number
52
+ | undefined;
53
+ /** how far the camera can rotate around the x-axis / look up-down, in radians. default unrestricted */
54
+ pitchRange?:
55
+ | number
56
+ | undefined;
57
+ /** note: cameras can never look up/down further than Vec3::Y */
58
+ rollRange?:
59
+ | number
60
+ | undefined;
61
+ /** minimum zoom level. must be greater than 0. defaults to the input zoom level */
62
+ zoomMin?:
63
+ | number
64
+ | undefined;
65
+ /** maximum zoom level. must be greater than 0. defaults to the input zoom level */
66
+ zoomMax?: number | undefined;
28
67
  }
29
68
 
30
69
  function createBasePBCameraModeArea(): PBCameraModeArea {
31
- return { area: undefined, mode: 0 };
70
+ return { area: undefined, mode: 0, cinematicSettings: undefined, useColliderRange: undefined };
32
71
  }
33
72
 
34
73
  export namespace PBCameraModeArea {
@@ -39,6 +78,12 @@ export namespace PBCameraModeArea {
39
78
  if (message.mode !== 0) {
40
79
  writer.uint32(16).int32(message.mode);
41
80
  }
81
+ if (message.cinematicSettings !== undefined) {
82
+ CinematicSettings.encode(message.cinematicSettings, writer.uint32(26).fork()).ldelim();
83
+ }
84
+ if (message.useColliderRange !== undefined) {
85
+ writer.uint32(32).bool(message.useColliderRange);
86
+ }
42
87
  return writer;
43
88
  }
44
89
 
@@ -63,6 +108,20 @@ export namespace PBCameraModeArea {
63
108
 
64
109
  message.mode = reader.int32() as any;
65
110
  continue;
111
+ case 3:
112
+ if (tag !== 26) {
113
+ break;
114
+ }
115
+
116
+ message.cinematicSettings = CinematicSettings.decode(reader, reader.uint32());
117
+ continue;
118
+ case 4:
119
+ if (tag !== 32) {
120
+ break;
121
+ }
122
+
123
+ message.useColliderRange = reader.bool();
124
+ continue;
66
125
  }
67
126
  if ((tag & 7) === 4 || tag === 0) {
68
127
  break;
@@ -76,6 +135,10 @@ export namespace PBCameraModeArea {
76
135
  return {
77
136
  area: isSet(object.area) ? Vector3.fromJSON(object.area) : undefined,
78
137
  mode: isSet(object.mode) ? cameraTypeFromJSON(object.mode) : 0,
138
+ cinematicSettings: isSet(object.cinematicSettings)
139
+ ? CinematicSettings.fromJSON(object.cinematicSettings)
140
+ : undefined,
141
+ useColliderRange: isSet(object.useColliderRange) ? Boolean(object.useColliderRange) : undefined,
79
142
  };
80
143
  }
81
144
 
@@ -83,6 +146,11 @@ export namespace PBCameraModeArea {
83
146
  const obj: any = {};
84
147
  message.area !== undefined && (obj.area = message.area ? Vector3.toJSON(message.area) : undefined);
85
148
  message.mode !== undefined && (obj.mode = cameraTypeToJSON(message.mode));
149
+ message.cinematicSettings !== undefined &&
150
+ (obj.cinematicSettings = message.cinematicSettings
151
+ ? CinematicSettings.toJSON(message.cinematicSettings)
152
+ : undefined);
153
+ message.useColliderRange !== undefined && (obj.useColliderRange = message.useColliderRange);
86
154
  return obj;
87
155
  }
88
156
 
@@ -94,6 +162,154 @@ export namespace PBCameraModeArea {
94
162
  const message = createBasePBCameraModeArea();
95
163
  message.area = (object.area !== undefined && object.area !== null) ? Vector3.fromPartial(object.area) : undefined;
96
164
  message.mode = object.mode ?? 0;
165
+ message.cinematicSettings = (object.cinematicSettings !== undefined && object.cinematicSettings !== null)
166
+ ? CinematicSettings.fromPartial(object.cinematicSettings)
167
+ : undefined;
168
+ message.useColliderRange = object.useColliderRange ?? undefined;
169
+ return message;
170
+ }
171
+ }
172
+
173
+ function createBaseCinematicSettings(): CinematicSettings {
174
+ return {
175
+ cameraEntity: 0,
176
+ allowManualRotation: undefined,
177
+ yawRange: undefined,
178
+ pitchRange: undefined,
179
+ rollRange: undefined,
180
+ zoomMin: undefined,
181
+ zoomMax: undefined,
182
+ };
183
+ }
184
+
185
+ export namespace CinematicSettings {
186
+ export function encode(message: CinematicSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
187
+ if (message.cameraEntity !== 0) {
188
+ writer.uint32(8).uint32(message.cameraEntity);
189
+ }
190
+ if (message.allowManualRotation !== undefined) {
191
+ writer.uint32(16).bool(message.allowManualRotation);
192
+ }
193
+ if (message.yawRange !== undefined) {
194
+ writer.uint32(29).float(message.yawRange);
195
+ }
196
+ if (message.pitchRange !== undefined) {
197
+ writer.uint32(37).float(message.pitchRange);
198
+ }
199
+ if (message.rollRange !== undefined) {
200
+ writer.uint32(45).float(message.rollRange);
201
+ }
202
+ if (message.zoomMin !== undefined) {
203
+ writer.uint32(53).float(message.zoomMin);
204
+ }
205
+ if (message.zoomMax !== undefined) {
206
+ writer.uint32(61).float(message.zoomMax);
207
+ }
208
+ return writer;
209
+ }
210
+
211
+ export function decode(input: _m0.Reader | Uint8Array, length?: number): CinematicSettings {
212
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
213
+ let end = length === undefined ? reader.len : reader.pos + length;
214
+ const message = createBaseCinematicSettings();
215
+ while (reader.pos < end) {
216
+ const tag = reader.uint32();
217
+ switch (tag >>> 3) {
218
+ case 1:
219
+ if (tag !== 8) {
220
+ break;
221
+ }
222
+
223
+ message.cameraEntity = reader.uint32();
224
+ continue;
225
+ case 2:
226
+ if (tag !== 16) {
227
+ break;
228
+ }
229
+
230
+ message.allowManualRotation = reader.bool();
231
+ continue;
232
+ case 3:
233
+ if (tag !== 29) {
234
+ break;
235
+ }
236
+
237
+ message.yawRange = reader.float();
238
+ continue;
239
+ case 4:
240
+ if (tag !== 37) {
241
+ break;
242
+ }
243
+
244
+ message.pitchRange = reader.float();
245
+ continue;
246
+ case 5:
247
+ if (tag !== 45) {
248
+ break;
249
+ }
250
+
251
+ message.rollRange = reader.float();
252
+ continue;
253
+ case 6:
254
+ if (tag !== 53) {
255
+ break;
256
+ }
257
+
258
+ message.zoomMin = reader.float();
259
+ continue;
260
+ case 7:
261
+ if (tag !== 61) {
262
+ break;
263
+ }
264
+
265
+ message.zoomMax = reader.float();
266
+ continue;
267
+ }
268
+ if ((tag & 7) === 4 || tag === 0) {
269
+ break;
270
+ }
271
+ reader.skipType(tag & 7);
272
+ }
273
+ return message;
274
+ }
275
+
276
+ export function fromJSON(object: any): CinematicSettings {
277
+ return {
278
+ cameraEntity: isSet(object.cameraEntity) ? Number(object.cameraEntity) : 0,
279
+ allowManualRotation: isSet(object.allowManualRotation) ? Boolean(object.allowManualRotation) : undefined,
280
+ yawRange: isSet(object.yawRange) ? Number(object.yawRange) : undefined,
281
+ pitchRange: isSet(object.pitchRange) ? Number(object.pitchRange) : undefined,
282
+ rollRange: isSet(object.rollRange) ? Number(object.rollRange) : undefined,
283
+ zoomMin: isSet(object.zoomMin) ? Number(object.zoomMin) : undefined,
284
+ zoomMax: isSet(object.zoomMax) ? Number(object.zoomMax) : undefined,
285
+ };
286
+ }
287
+
288
+ export function toJSON(message: CinematicSettings): unknown {
289
+ const obj: any = {};
290
+ message.cameraEntity !== undefined && (obj.cameraEntity = Math.round(message.cameraEntity));
291
+ message.allowManualRotation !== undefined && (obj.allowManualRotation = message.allowManualRotation);
292
+ message.yawRange !== undefined && (obj.yawRange = message.yawRange);
293
+ message.pitchRange !== undefined && (obj.pitchRange = message.pitchRange);
294
+ message.rollRange !== undefined && (obj.rollRange = message.rollRange);
295
+ message.zoomMin !== undefined && (obj.zoomMin = message.zoomMin);
296
+ message.zoomMax !== undefined && (obj.zoomMax = message.zoomMax);
297
+ return obj;
298
+ }
299
+
300
+ export function create<I extends Exact<DeepPartial<CinematicSettings>, I>>(base?: I): CinematicSettings {
301
+ return CinematicSettings.fromPartial(base ?? {});
302
+ }
303
+
304
+ export function fromPartial<I extends Exact<DeepPartial<CinematicSettings>, I>>(object: I): CinematicSettings {
305
+ const message = createBaseCinematicSettings();
306
+ message.cameraEntity = object.cameraEntity ?? 0;
307
+ message.allowManualRotation = object.allowManualRotation ?? undefined;
308
+ message.yawRange = object.yawRange ?? undefined;
309
+ message.pitchRange = object.pitchRange ?? undefined;
310
+ message.rollRange = object.rollRange ?? undefined;
311
+ message.zoomMin = object.zoomMin ?? undefined;
312
+ message.zoomMax = object.zoomMax ?? undefined;
97
313
  return message;
98
314
  }
99
315
  }
@@ -10,10 +10,29 @@ export const protobufPackage = "decentraland.sdk.components";
10
10
  */
11
11
  export interface PBGltfContainerLoadingState {
12
12
  currentState: LoadingState;
13
+ /** all node paths in the gltf, which can be used with a GltfNode to inspect and modify the gltf contents */
14
+ nodePaths: string[];
15
+ /** all meshes in the gltf. unnamed meshes will be auto-assigned a name of the form `MeshX` or `MeshX/PrimitiveY` */
16
+ meshNames: string[];
17
+ /**
18
+ * where X is the mesh index and Y is the primitive index (and there is more than 1 primitive). note this may
19
+ * conflict with manually named meshes - to avoid any issues make sure all your meshes are explicitly named.
20
+ */
21
+ materialNames: string[];
22
+ /**
23
+ * X is the material index. note this may conflict with manually named materials - to avoid any issues make
24
+ * sure all your materials are explicitly named.
25
+ */
26
+ skinNames: string[];
27
+ /**
28
+ * X is the skin index. note this may conflict with manually named skins - to avoid any issues make sure all
29
+ * your skins are explicitly named.
30
+ */
31
+ animationNames: string[];
13
32
  }
14
33
 
15
34
  function createBasePBGltfContainerLoadingState(): PBGltfContainerLoadingState {
16
- return { currentState: 0 };
35
+ return { currentState: 0, nodePaths: [], meshNames: [], materialNames: [], skinNames: [], animationNames: [] };
17
36
  }
18
37
 
19
38
  export namespace PBGltfContainerLoadingState {
@@ -21,6 +40,21 @@ export namespace PBGltfContainerLoadingState {
21
40
  if (message.currentState !== 0) {
22
41
  writer.uint32(8).int32(message.currentState);
23
42
  }
43
+ for (const v of message.nodePaths) {
44
+ writer.uint32(18).string(v!);
45
+ }
46
+ for (const v of message.meshNames) {
47
+ writer.uint32(26).string(v!);
48
+ }
49
+ for (const v of message.materialNames) {
50
+ writer.uint32(34).string(v!);
51
+ }
52
+ for (const v of message.skinNames) {
53
+ writer.uint32(42).string(v!);
54
+ }
55
+ for (const v of message.animationNames) {
56
+ writer.uint32(50).string(v!);
57
+ }
24
58
  return writer;
25
59
  }
26
60
 
@@ -38,6 +72,41 @@ export namespace PBGltfContainerLoadingState {
38
72
 
39
73
  message.currentState = reader.int32() as any;
40
74
  continue;
75
+ case 2:
76
+ if (tag !== 18) {
77
+ break;
78
+ }
79
+
80
+ message.nodePaths.push(reader.string());
81
+ continue;
82
+ case 3:
83
+ if (tag !== 26) {
84
+ break;
85
+ }
86
+
87
+ message.meshNames.push(reader.string());
88
+ continue;
89
+ case 4:
90
+ if (tag !== 34) {
91
+ break;
92
+ }
93
+
94
+ message.materialNames.push(reader.string());
95
+ continue;
96
+ case 5:
97
+ if (tag !== 42) {
98
+ break;
99
+ }
100
+
101
+ message.skinNames.push(reader.string());
102
+ continue;
103
+ case 6:
104
+ if (tag !== 50) {
105
+ break;
106
+ }
107
+
108
+ message.animationNames.push(reader.string());
109
+ continue;
41
110
  }
42
111
  if ((tag & 7) === 4 || tag === 0) {
43
112
  break;
@@ -48,12 +117,44 @@ export namespace PBGltfContainerLoadingState {
48
117
  }
49
118
 
50
119
  export function fromJSON(object: any): PBGltfContainerLoadingState {
51
- return { currentState: isSet(object.currentState) ? loadingStateFromJSON(object.currentState) : 0 };
120
+ return {
121
+ currentState: isSet(object.currentState) ? loadingStateFromJSON(object.currentState) : 0,
122
+ nodePaths: Array.isArray(object?.nodePaths) ? object.nodePaths.map((e: any) => String(e)) : [],
123
+ meshNames: Array.isArray(object?.meshNames) ? object.meshNames.map((e: any) => String(e)) : [],
124
+ materialNames: Array.isArray(object?.materialNames) ? object.materialNames.map((e: any) => String(e)) : [],
125
+ skinNames: Array.isArray(object?.skinNames) ? object.skinNames.map((e: any) => String(e)) : [],
126
+ animationNames: Array.isArray(object?.animationNames) ? object.animationNames.map((e: any) => String(e)) : [],
127
+ };
52
128
  }
53
129
 
54
130
  export function toJSON(message: PBGltfContainerLoadingState): unknown {
55
131
  const obj: any = {};
56
132
  message.currentState !== undefined && (obj.currentState = loadingStateToJSON(message.currentState));
133
+ if (message.nodePaths) {
134
+ obj.nodePaths = message.nodePaths.map((e) => e);
135
+ } else {
136
+ obj.nodePaths = [];
137
+ }
138
+ if (message.meshNames) {
139
+ obj.meshNames = message.meshNames.map((e) => e);
140
+ } else {
141
+ obj.meshNames = [];
142
+ }
143
+ if (message.materialNames) {
144
+ obj.materialNames = message.materialNames.map((e) => e);
145
+ } else {
146
+ obj.materialNames = [];
147
+ }
148
+ if (message.skinNames) {
149
+ obj.skinNames = message.skinNames.map((e) => e);
150
+ } else {
151
+ obj.skinNames = [];
152
+ }
153
+ if (message.animationNames) {
154
+ obj.animationNames = message.animationNames.map((e) => e);
155
+ } else {
156
+ obj.animationNames = [];
157
+ }
57
158
  return obj;
58
159
  }
59
160
 
@@ -68,6 +169,11 @@ export namespace PBGltfContainerLoadingState {
68
169
  ): PBGltfContainerLoadingState {
69
170
  const message = createBasePBGltfContainerLoadingState();
70
171
  message.currentState = object.currentState ?? 0;
172
+ message.nodePaths = object.nodePaths?.map((e) => e) || [];
173
+ message.meshNames = object.meshNames?.map((e) => e) || [];
174
+ message.materialNames = object.materialNames?.map((e) => e) || [];
175
+ message.skinNames = object.skinNames?.map((e) => e) || [];
176
+ message.animationNames = object.animationNames?.map((e) => e) || [];
71
177
  return message;
72
178
  }
73
179
  }
@@ -0,0 +1,116 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+
4
+ export const protobufPackage = "decentraland.sdk.components";
5
+
6
+ /**
7
+ * a GltfNode links a scene entity with a node from within a gltf, allowing the scene to inspect it or modify it.
8
+ * This component must be added to a direct child of an entity with a PBGltfContainer component, or
9
+ * to a direct child of another entity with a GltfNode component, and the referenced gltf node must be a descendent of the gltf node
10
+ * in the parent.
11
+ * The name must match the path of one of the nodes within the Gltf. These are available on the GltfContainerLoadingState component.
12
+ *
13
+ * The renderer will attach a PBGltfNodeState to the entity describing the state. Once the state is `GNS_READY`,
14
+ * - the `Transform` will be updated to match the position of the node within the gltf (relative to the gltf root, or the parent node),
15
+ * - a `MeshRenderer` with a GltfMesh mesh type will be added (if the gltf node has a mesh).
16
+ * - a `MeshCollider` with a GltfMesh mesh type will be added (if the gltf node has a collider).
17
+ * - a `Material` component including a GltfMaterial reference will be added (if the gltf node has a material).
18
+ *
19
+ * After creation, if an animation moves the node, the `Transform` will be updated.
20
+ *
21
+ * From the scene, you can modify various components to alter the gltf node:
22
+ * - modifying the `Transform` position/rotation/scale will move the node. The position is interpreted relative to the gltf root (or parent node),
23
+ * regardless of any intermediate gltf node hierarchy.
24
+ * If an animation is playing, the animation takes priority and the scene entity's position will be updated to match the animation.
25
+ * - `Visibility` can be added to hide or show the node and it's children in the gltf hierarchy.
26
+ * - `MeshRenderer` can be added/modified/removed to create/modify/remove a mesh on the node.
27
+ * - `MeshCollider` can be added/modified/removed to create/modify/remove a collider on the node.
28
+ * - `Material` can be added or modified to change the material properties. If the gltf node has a material, the original material will be
29
+ * used as a base, and any gltf features (e.g. occlusion maps) from the gtlf spec that the renderer supports but that are not exposed in the
30
+ * PBMaterial will be maintained.
31
+ *
32
+ * The scene can add additional entities as children to the gltf node, but structural modifications of the gltf are not possible:
33
+ * - changing the scene hierarchy will not change the gltf node hierarchy. Moving the entity out of the gltf will sever the link and
34
+ * change the state to `GNS_FAILED`.
35
+ * - deleting the scene entity will not delete the gltf node.
36
+ *
37
+ * Removing the GltfNode will revert any changes to the original gltf. If the GltfNode component is removed and the mesh/collider/material
38
+ * are not removed, this will result in a duplication of these components as the previously-linked entity will retain it's components and
39
+ * the gltf node will also be displayed.
40
+ */
41
+ export interface PBGltfNode {
42
+ /** the path of the target node in the Gltf. */
43
+ path: string;
44
+ }
45
+
46
+ function createBasePBGltfNode(): PBGltfNode {
47
+ return { path: "" };
48
+ }
49
+
50
+ export namespace PBGltfNode {
51
+ export function encode(message: PBGltfNode, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
52
+ if (message.path !== "") {
53
+ writer.uint32(10).string(message.path);
54
+ }
55
+ return writer;
56
+ }
57
+
58
+ export function decode(input: _m0.Reader | Uint8Array, length?: number): PBGltfNode {
59
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
60
+ let end = length === undefined ? reader.len : reader.pos + length;
61
+ const message = createBasePBGltfNode();
62
+ while (reader.pos < end) {
63
+ const tag = reader.uint32();
64
+ switch (tag >>> 3) {
65
+ case 1:
66
+ if (tag !== 10) {
67
+ break;
68
+ }
69
+
70
+ message.path = reader.string();
71
+ continue;
72
+ }
73
+ if ((tag & 7) === 4 || tag === 0) {
74
+ break;
75
+ }
76
+ reader.skipType(tag & 7);
77
+ }
78
+ return message;
79
+ }
80
+
81
+ export function fromJSON(object: any): PBGltfNode {
82
+ return { path: isSet(object.path) ? String(object.path) : "" };
83
+ }
84
+
85
+ export function toJSON(message: PBGltfNode): unknown {
86
+ const obj: any = {};
87
+ message.path !== undefined && (obj.path = message.path);
88
+ return obj;
89
+ }
90
+
91
+ export function create<I extends Exact<DeepPartial<PBGltfNode>, I>>(base?: I): PBGltfNode {
92
+ return PBGltfNode.fromPartial(base ?? {});
93
+ }
94
+
95
+ export function fromPartial<I extends Exact<DeepPartial<PBGltfNode>, I>>(object: I): PBGltfNode {
96
+ const message = createBasePBGltfNode();
97
+ message.path = object.path ?? "";
98
+ return message;
99
+ }
100
+ }
101
+
102
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
103
+
104
+ export type DeepPartial<T> = T extends Builtin ? T
105
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
106
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
107
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
108
+ : Partial<T>;
109
+
110
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
111
+ export type Exact<P, I extends P> = P extends Builtin ? P
112
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
113
+
114
+ function isSet(value: any): boolean {
115
+ return value !== null && value !== undefined;
116
+ }
@@ -0,0 +1,139 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+
4
+ export const protobufPackage = "decentraland.sdk.components";
5
+
6
+ export enum GltfNodeStateValue {
7
+ GNSV_PENDING = 0,
8
+ GNSV_FAILED = 1,
9
+ GNSV_READY = 2,
10
+ UNRECOGNIZED = -1,
11
+ }
12
+
13
+ export function gltfNodeStateValueFromJSON(object: any): GltfNodeStateValue {
14
+ switch (object) {
15
+ case 0:
16
+ case "GNSV_PENDING":
17
+ return GltfNodeStateValue.GNSV_PENDING;
18
+ case 1:
19
+ case "GNSV_FAILED":
20
+ return GltfNodeStateValue.GNSV_FAILED;
21
+ case 2:
22
+ case "GNSV_READY":
23
+ return GltfNodeStateValue.GNSV_READY;
24
+ case -1:
25
+ case "UNRECOGNIZED":
26
+ default:
27
+ return GltfNodeStateValue.UNRECOGNIZED;
28
+ }
29
+ }
30
+
31
+ export function gltfNodeStateValueToJSON(object: GltfNodeStateValue): string {
32
+ switch (object) {
33
+ case GltfNodeStateValue.GNSV_PENDING:
34
+ return "GNSV_PENDING";
35
+ case GltfNodeStateValue.GNSV_FAILED:
36
+ return "GNSV_FAILED";
37
+ case GltfNodeStateValue.GNSV_READY:
38
+ return "GNSV_READY";
39
+ case GltfNodeStateValue.UNRECOGNIZED:
40
+ default:
41
+ return "UNRECOGNIZED";
42
+ }
43
+ }
44
+
45
+ /**
46
+ * The state of a linked gltf node.
47
+ * If the state is GNSV_FAILED, the renderer may describe the failure in the error string.
48
+ */
49
+ export interface PBGltfNodeState {
50
+ state: GltfNodeStateValue;
51
+ error?: string | undefined;
52
+ }
53
+
54
+ function createBasePBGltfNodeState(): PBGltfNodeState {
55
+ return { state: 0, error: undefined };
56
+ }
57
+
58
+ export namespace PBGltfNodeState {
59
+ export function encode(message: PBGltfNodeState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
60
+ if (message.state !== 0) {
61
+ writer.uint32(8).int32(message.state);
62
+ }
63
+ if (message.error !== undefined) {
64
+ writer.uint32(18).string(message.error);
65
+ }
66
+ return writer;
67
+ }
68
+
69
+ export function decode(input: _m0.Reader | Uint8Array, length?: number): PBGltfNodeState {
70
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
71
+ let end = length === undefined ? reader.len : reader.pos + length;
72
+ const message = createBasePBGltfNodeState();
73
+ while (reader.pos < end) {
74
+ const tag = reader.uint32();
75
+ switch (tag >>> 3) {
76
+ case 1:
77
+ if (tag !== 8) {
78
+ break;
79
+ }
80
+
81
+ message.state = reader.int32() as any;
82
+ continue;
83
+ case 2:
84
+ if (tag !== 18) {
85
+ break;
86
+ }
87
+
88
+ message.error = reader.string();
89
+ continue;
90
+ }
91
+ if ((tag & 7) === 4 || tag === 0) {
92
+ break;
93
+ }
94
+ reader.skipType(tag & 7);
95
+ }
96
+ return message;
97
+ }
98
+
99
+ export function fromJSON(object: any): PBGltfNodeState {
100
+ return {
101
+ state: isSet(object.state) ? gltfNodeStateValueFromJSON(object.state) : 0,
102
+ error: isSet(object.error) ? String(object.error) : undefined,
103
+ };
104
+ }
105
+
106
+ export function toJSON(message: PBGltfNodeState): unknown {
107
+ const obj: any = {};
108
+ message.state !== undefined && (obj.state = gltfNodeStateValueToJSON(message.state));
109
+ message.error !== undefined && (obj.error = message.error);
110
+ return obj;
111
+ }
112
+
113
+ export function create<I extends Exact<DeepPartial<PBGltfNodeState>, I>>(base?: I): PBGltfNodeState {
114
+ return PBGltfNodeState.fromPartial(base ?? {});
115
+ }
116
+
117
+ export function fromPartial<I extends Exact<DeepPartial<PBGltfNodeState>, I>>(object: I): PBGltfNodeState {
118
+ const message = createBasePBGltfNodeState();
119
+ message.state = object.state ?? 0;
120
+ message.error = object.error ?? undefined;
121
+ return message;
122
+ }
123
+ }
124
+
125
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
126
+
127
+ export type DeepPartial<T> = T extends Builtin ? T
128
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
129
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
130
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
131
+ : Partial<T>;
132
+
133
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
134
+ export type Exact<P, I extends P> = P extends Builtin ? P
135
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
136
+
137
+ function isSet(value: any): boolean {
138
+ return value !== null && value !== undefined;
139
+ }