@dcl/sdk 7.0.0-2956503917.commit-061e376 → 7.0.0-2966684214.commit-a567432

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.
@@ -229,6 +229,8 @@ export declare namespace Components {
229
229
  /** @public */
230
230
  const Material: ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
231
231
  /** @public */
232
+ const MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
233
+ /** @public */
232
234
  const MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
233
235
  /** @public */
234
236
  const NFTShape: ComponentDefinition<ISchema<PBNFTShape>, PBNFTShape>;
@@ -407,14 +409,36 @@ declare interface CreateByteBufferOptions {
407
409
  /** @public */
408
410
  export declare const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
409
411
 
412
+ /**
413
+ * @public
414
+ */
415
+ export declare type DeepReadonly<T> = T extends ReadonlyPrimitive ? T : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends Set<infer M> ? DeepReadonlySet<M> : DeepReadonlyObject<T>;
416
+
410
417
  /**
411
418
  * Make each field readonly deeply
412
419
  * @public
413
420
  */
414
- export declare type DeepReadonly<T> = {
415
- readonly [P in keyof T]: DeepReadonly<T[P]>;
421
+ declare type DeepReadonly_2<T> = {
422
+ readonly [P in keyof T]: DeepReadonly_2<T[P]>;
416
423
  };
417
424
 
425
+ /**
426
+ * @public
427
+ */
428
+ export declare type DeepReadonlyMap<K, V> = ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>;
429
+
430
+ /**
431
+ * @public
432
+ */
433
+ export declare type DeepReadonlyObject<T> = {
434
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
435
+ };
436
+
437
+ /**
438
+ * @public
439
+ */
440
+ export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
441
+
418
442
  declare function defineSdkComponents(engine: PreEngine): {
419
443
  Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
420
444
  MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
@@ -430,6 +454,7 @@ declare function defineSdkComponents(engine: PreEngine): {
430
454
  CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
431
455
  GLTFShape: ComponentDefinition<ISchema<PBGLTFShape>, PBGLTFShape>;
432
456
  Material: ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
457
+ MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
433
458
  NFTShape: ComponentDefinition<ISchema<PBNFTShape>, PBNFTShape>;
434
459
  OnPointerDown: ComponentDefinition<ISchema<PBOnPointerDown>, PBOnPointerDown>;
435
460
  OnPointerDownResult: ComponentDefinition<ISchema<PBOnPointerDownResult>, PBOnPointerDownResult>;
@@ -462,10 +487,6 @@ declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['de
462
487
  */
463
488
  export declare function Engine({ transports }?: IEngineParams): IEngine;
464
489
 
465
- /**
466
- * @alpha * This file initialization is an alpha one. This is based on the old-ecs
467
- * init and it'll be changing.
468
- */
469
490
  export declare const engine: IEngine;
470
491
 
471
492
  /**
@@ -570,7 +591,7 @@ export declare type IEngine = {
570
591
  *
571
592
  * ```
572
593
  */
573
- defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: Spec, componentId: number, constructorDefault?: Partial<Result<T>>): ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
594
+ defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: Partial<Result<T>>): ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
574
595
  /**
575
596
  * Define a component and add it to the engine.
576
597
  * @param spec An object with schema fields
@@ -601,11 +622,11 @@ export declare type IEngine = {
601
622
  * Example:
602
623
  * ```ts
603
624
  * for (const [entity, boxShape, transform] of engine.getEntitiesWith(BoxShape, Transform)) {
604
- * // the properties of boxShape and transform are read only
625
+ * // the properties of boxShape and transform are read only
605
626
  * }
606
627
  * ```
607
628
  */
608
- getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...DeepReadonly<ComponentSchema<T>>]>;
629
+ getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
609
630
  baseComponents: SdkComponents;
610
631
  };
611
632
 
@@ -639,7 +660,7 @@ declare function IOptional<T>(spec: ISchema<T>): ISchema<T | undefined>;
639
660
  /**
640
661
  * @public
641
662
  */
642
- declare type ISchema<T = any> = {
663
+ export declare type ISchema<T = any> = {
643
664
  serialize(value: T, builder: ByteBuffer): void;
644
665
  deserialize(reader: ByteBuffer): T;
645
666
  create(): T;
@@ -701,7 +722,7 @@ declare namespace Matrix {
701
722
  _isIdentity3x2Dirty: boolean;
702
723
  _m: Matrix4x4;
703
724
  };
704
- type ReadonlyMatrix = DeepReadonly<MutableMatrix>;
725
+ type ReadonlyMatrix = DeepReadonly_2<MutableMatrix>;
705
726
  /**
706
727
  * Gets the internal data of the matrix
707
728
  */
@@ -1384,6 +1405,9 @@ declare namespace Matrix {
1384
1405
  function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
1385
1406
  }
1386
1407
 
1408
+ /** @public */
1409
+ export declare const MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
1410
+
1387
1411
  /** @public */
1388
1412
  export declare const MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
1389
1413
 
@@ -1573,6 +1597,31 @@ declare interface PBMaterial_Texture {
1573
1597
  filterMode?: FilterMode | undefined;
1574
1598
  }
1575
1599
 
1600
+ declare interface PBMeshCollider {
1601
+ /** default = ColliderLayer.Physics | ColliderLayer.Pointer */
1602
+ collisionMask?: number | undefined;
1603
+ box: PBMeshCollider_BoxMesh | undefined;
1604
+ sphere: PBMeshCollider_SphereMesh | undefined;
1605
+ cylinder: PBMeshCollider_CylinderMesh | undefined;
1606
+ plane: PBMeshCollider_PlaneMesh | undefined;
1607
+ }
1608
+
1609
+ declare interface PBMeshCollider_BoxMesh {
1610
+ }
1611
+
1612
+ declare interface PBMeshCollider_CylinderMesh {
1613
+ /** default=1.0 */
1614
+ radiusTop?: number | undefined;
1615
+ /** default=1.0 */
1616
+ radiusBottom?: number | undefined;
1617
+ }
1618
+
1619
+ declare interface PBMeshCollider_PlaneMesh {
1620
+ }
1621
+
1622
+ declare interface PBMeshCollider_SphereMesh {
1623
+ }
1624
+
1576
1625
  declare interface PBMeshRenderer {
1577
1626
  box: PBMeshRenderer_BoxMesh | undefined;
1578
1627
  sphere: PBMeshRenderer_SphereMesh | undefined;
@@ -1740,7 +1789,7 @@ declare namespace Plane {
1740
1789
  */
1741
1790
  d: number;
1742
1791
  };
1743
- type ReadonlyPlane = DeepReadonly<MutablePlane>;
1792
+ type ReadonlyPlane = DeepReadonly_2<MutablePlane>;
1744
1793
  /**
1745
1794
  * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
1746
1795
  * @param a - a component of the plane
@@ -1860,7 +1909,7 @@ declare function preEngine(): {
1860
1909
  removeSystem: (selector: string | Update) => boolean;
1861
1910
  defineComponent: <T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType | undefined) => ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
1862
1911
  defineComponentFromSchema: <T_1 extends ISchema<any>, ConstructorType_1 = EcsResult<T_1>>(spec: T_1, componentId: number, constructorDefault?: ConstructorType_1 | undefined) => ComponentDefinition<T_1, ConstructorType_1>;
1863
- getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...DeepReadonly<ComponentSchema<T_2>>]>;
1912
+ getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...ReadonlyComponentSchema<T_2>]>;
1864
1913
  getComponent: <T_3 extends ISchema<any>>(componentId: number) => ComponentDefinition<T_3, EcsResult<T_3>>;
1865
1914
  removeComponentDefinition: (componentId: number) => void;
1866
1915
  };
@@ -1881,7 +1930,7 @@ export declare namespace Quaternion {
1881
1930
  /**
1882
1931
  * @public
1883
1932
  */
1884
- export type ReadonlyQuaternion = DeepReadonly<MutableQuaternion>;
1933
+ export type ReadonlyQuaternion = DeepReadonly_2<MutableQuaternion>;
1885
1934
  /**
1886
1935
  * Creates a new Quaternion from the given floats
1887
1936
  * @param x - defines the first component (0 by default)
@@ -2035,6 +2084,18 @@ export declare namespace Quaternion {
2035
2084
  */
2036
2085
  export declare const RAD2DEG: number;
2037
2086
 
2087
+ /**
2088
+ * @public
2089
+ */
2090
+ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
2091
+ [K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['get']> : never;
2092
+ };
2093
+
2094
+ /**
2095
+ * @public
2096
+ */
2097
+ export declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
2098
+
2038
2099
  declare type ReceiveMessage = {
2039
2100
  type: WireMessage.Enum;
2040
2101
  entity: Entity;
@@ -2199,7 +2260,7 @@ export declare namespace Vector3 {
2199
2260
  /**
2200
2261
  * @public
2201
2262
  */
2202
- export type ReadonlyVector3 = DeepReadonly<MutableVector3>;
2263
+ export type ReadonlyVector3 = DeepReadonly_2<MutableVector3>;
2203
2264
  /**
2204
2265
  * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
2205
2266
  * @param x - defines the first coordinates (on X axis)