@dcl/playground-assets 7.0.6-3808797047.commit-ee7ea04 → 7.0.6-3808988484.commit-63d3e2c
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/dist/alpha.d.ts +47 -12
- package/dist/beta.d.ts +47 -12
- package/dist/index.bundled.d.ts +47 -12
- package/dist/index.js +60 -77
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground-assets.d.ts +47 -12
- package/etc/playground-assets.api.json +278 -13
- package/etc/playground-assets.api.md +48 -12
- package/package.json +3 -3
package/dist/alpha.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _m0 from 'protobufjs/minimal';
|
|
2
2
|
|
|
3
|
+
export declare const AMOUNT_VERSION_AVAILABLE: number;
|
|
4
|
+
|
|
3
5
|
export declare const Animator: AnimatorComponentDefinitionExtended;
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -981,8 +983,8 @@ export declare type Color4Type = {
|
|
|
981
983
|
};
|
|
982
984
|
|
|
983
985
|
export declare type CommonProps = {
|
|
984
|
-
key
|
|
985
|
-
children
|
|
986
|
+
key?: Key;
|
|
987
|
+
children?: Children;
|
|
986
988
|
};
|
|
987
989
|
|
|
988
990
|
/**
|
|
@@ -1170,9 +1172,20 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1170
1172
|
};
|
|
1171
1173
|
|
|
1172
1174
|
/**
|
|
1173
|
-
* @public
|
|
1175
|
+
* @public The Entity is a number type, the cast is only for typescript, the final javascript code treat as a number
|
|
1176
|
+
* version number
|
|
1177
|
+
* [31...16][15...0]
|
|
1178
|
+
*
|
|
1179
|
+
* Convertion from entity to its compound numbers:
|
|
1180
|
+
* To get the version => ((entity & MASK_UPPER_16_ON_32) >> 16) & MAX_U16
|
|
1181
|
+
* To get the number => entity & MAX_U16
|
|
1182
|
+
*
|
|
1183
|
+
* Convertion from its compound numbers to entity:
|
|
1184
|
+
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1174
1185
|
*/
|
|
1175
|
-
export declare type Entity =
|
|
1186
|
+
export declare type Entity = uint32 & {
|
|
1187
|
+
__entity_type: '';
|
|
1188
|
+
};
|
|
1176
1189
|
|
|
1177
1190
|
export declare type EntityComponents = {
|
|
1178
1191
|
uiTransform: PBUiTransform;
|
|
@@ -1185,10 +1198,13 @@ export declare type EntityComponents = {
|
|
|
1185
1198
|
};
|
|
1186
1199
|
|
|
1187
1200
|
export declare function EntityContainer(): {
|
|
1188
|
-
generateEntity(
|
|
1201
|
+
generateEntity(): Entity;
|
|
1189
1202
|
removeEntity(entity: Entity): boolean;
|
|
1190
1203
|
entityExists(entity: Entity): boolean;
|
|
1191
1204
|
getExistingEntities(): Set<Entity>;
|
|
1205
|
+
entityVersion: (entity: Entity) => number;
|
|
1206
|
+
entityNumber: (entity: Entity) => number;
|
|
1207
|
+
entityId: (entityNumber: number, entityVersion: number) => Entity;
|
|
1192
1208
|
};
|
|
1193
1209
|
|
|
1194
1210
|
/**
|
|
@@ -1197,7 +1213,7 @@ export declare function EntityContainer(): {
|
|
|
1197
1213
|
export declare type EntityPropTypes = {
|
|
1198
1214
|
uiTransform?: UiTransformProps;
|
|
1199
1215
|
uiBackground?: UiBackgroundProps;
|
|
1200
|
-
} & Listeners
|
|
1216
|
+
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1201
1217
|
|
|
1202
1218
|
/**
|
|
1203
1219
|
* Constant used to define the minimal number value in Babylon.js
|
|
@@ -1683,6 +1699,8 @@ export declare type MapResult<T extends Spec> = ToOptional<{
|
|
|
1683
1699
|
[K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? MapResult<T[K]> : never;
|
|
1684
1700
|
}>;
|
|
1685
1701
|
|
|
1702
|
+
export declare const MASK_UPPER_16_ON_32 = 4294901760;
|
|
1703
|
+
|
|
1686
1704
|
export declare const Material: MaterialComponentDefinitionExtended;
|
|
1687
1705
|
|
|
1688
1706
|
/**
|
|
@@ -2451,6 +2469,13 @@ export declare namespace Matrix {
|
|
|
2451
2469
|
export function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
|
|
2452
2470
|
}
|
|
2453
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* @public
|
|
2474
|
+
*/
|
|
2475
|
+
export declare const MAX_ENTITY_NUMBER = 65535;
|
|
2476
|
+
|
|
2477
|
+
export declare const MAX_U16 = 65535;
|
|
2478
|
+
|
|
2454
2479
|
export declare const MeshCollider: MeshColliderComponentDefinitionExtended;
|
|
2455
2480
|
|
|
2456
2481
|
/**
|
|
@@ -3687,12 +3712,12 @@ export declare const PointerEventsResult: ComponentDefinition<PBPointerEventsRes
|
|
|
3687
3712
|
export declare type PointerEventsSystem = ReturnType<typeof createPointerEventSystem>;
|
|
3688
3713
|
|
|
3689
3714
|
export declare const pointerEventsSystem: {
|
|
3690
|
-
removeOnClick(entity:
|
|
3691
|
-
removeOnPointerDown(entity:
|
|
3692
|
-
removeOnPointerUp(entity:
|
|
3693
|
-
onClick(entity:
|
|
3694
|
-
onPointerDown(entity:
|
|
3695
|
-
onPointerUp(entity:
|
|
3715
|
+
removeOnClick(entity: Entity): void;
|
|
3716
|
+
removeOnPointerDown(entity: Entity): void;
|
|
3717
|
+
removeOnPointerUp(entity: Entity): void;
|
|
3718
|
+
onClick(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3719
|
+
onPointerDown(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3720
|
+
onPointerUp(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3696
3721
|
};
|
|
3697
3722
|
|
|
3698
3723
|
export declare const enum PointerEventType {
|
|
@@ -4055,6 +4080,11 @@ export declare type ReceiveMessage = {
|
|
|
4055
4080
|
messageBuffer: Uint8Array;
|
|
4056
4081
|
};
|
|
4057
4082
|
|
|
4083
|
+
/**
|
|
4084
|
+
* @public This first 512 entities are reserved by the renderer
|
|
4085
|
+
*/
|
|
4086
|
+
export declare const RESERVED_STATIC_ENTITIES = 512;
|
|
4087
|
+
|
|
4058
4088
|
export declare type RPCSendableMessage = {
|
|
4059
4089
|
jsonrpc: '2.0';
|
|
4060
4090
|
id: number;
|
|
@@ -4495,6 +4525,11 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4495
4525
|
/** @public */
|
|
4496
4526
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4497
4527
|
|
|
4528
|
+
/**
|
|
4529
|
+
* @public It only defines the type explicitly, no effects.
|
|
4530
|
+
*/
|
|
4531
|
+
export declare type uint32 = number;
|
|
4532
|
+
|
|
4498
4533
|
/** @public */
|
|
4499
4534
|
export declare const UiText: ComponentDefinition<PBUiText>;
|
|
4500
4535
|
|
package/dist/beta.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _m0 from 'protobufjs/minimal';
|
|
2
2
|
|
|
3
|
+
export declare const AMOUNT_VERSION_AVAILABLE: number;
|
|
4
|
+
|
|
3
5
|
export declare const Animator: AnimatorComponentDefinitionExtended;
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -981,8 +983,8 @@ export declare type Color4Type = {
|
|
|
981
983
|
};
|
|
982
984
|
|
|
983
985
|
export declare type CommonProps = {
|
|
984
|
-
key
|
|
985
|
-
children
|
|
986
|
+
key?: Key;
|
|
987
|
+
children?: Children;
|
|
986
988
|
};
|
|
987
989
|
|
|
988
990
|
/**
|
|
@@ -1170,9 +1172,20 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1170
1172
|
};
|
|
1171
1173
|
|
|
1172
1174
|
/**
|
|
1173
|
-
* @public
|
|
1175
|
+
* @public The Entity is a number type, the cast is only for typescript, the final javascript code treat as a number
|
|
1176
|
+
* version number
|
|
1177
|
+
* [31...16][15...0]
|
|
1178
|
+
*
|
|
1179
|
+
* Convertion from entity to its compound numbers:
|
|
1180
|
+
* To get the version => ((entity & MASK_UPPER_16_ON_32) >> 16) & MAX_U16
|
|
1181
|
+
* To get the number => entity & MAX_U16
|
|
1182
|
+
*
|
|
1183
|
+
* Convertion from its compound numbers to entity:
|
|
1184
|
+
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1174
1185
|
*/
|
|
1175
|
-
export declare type Entity =
|
|
1186
|
+
export declare type Entity = uint32 & {
|
|
1187
|
+
__entity_type: '';
|
|
1188
|
+
};
|
|
1176
1189
|
|
|
1177
1190
|
export declare type EntityComponents = {
|
|
1178
1191
|
uiTransform: PBUiTransform;
|
|
@@ -1185,10 +1198,13 @@ export declare type EntityComponents = {
|
|
|
1185
1198
|
};
|
|
1186
1199
|
|
|
1187
1200
|
export declare function EntityContainer(): {
|
|
1188
|
-
generateEntity(
|
|
1201
|
+
generateEntity(): Entity;
|
|
1189
1202
|
removeEntity(entity: Entity): boolean;
|
|
1190
1203
|
entityExists(entity: Entity): boolean;
|
|
1191
1204
|
getExistingEntities(): Set<Entity>;
|
|
1205
|
+
entityVersion: (entity: Entity) => number;
|
|
1206
|
+
entityNumber: (entity: Entity) => number;
|
|
1207
|
+
entityId: (entityNumber: number, entityVersion: number) => Entity;
|
|
1192
1208
|
};
|
|
1193
1209
|
|
|
1194
1210
|
/**
|
|
@@ -1197,7 +1213,7 @@ export declare function EntityContainer(): {
|
|
|
1197
1213
|
export declare type EntityPropTypes = {
|
|
1198
1214
|
uiTransform?: UiTransformProps;
|
|
1199
1215
|
uiBackground?: UiBackgroundProps;
|
|
1200
|
-
} & Listeners
|
|
1216
|
+
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1201
1217
|
|
|
1202
1218
|
/**
|
|
1203
1219
|
* Constant used to define the minimal number value in Babylon.js
|
|
@@ -1683,6 +1699,8 @@ export declare type MapResult<T extends Spec> = ToOptional<{
|
|
|
1683
1699
|
[K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? MapResult<T[K]> : never;
|
|
1684
1700
|
}>;
|
|
1685
1701
|
|
|
1702
|
+
export declare const MASK_UPPER_16_ON_32 = 4294901760;
|
|
1703
|
+
|
|
1686
1704
|
export declare const Material: MaterialComponentDefinitionExtended;
|
|
1687
1705
|
|
|
1688
1706
|
/**
|
|
@@ -2451,6 +2469,13 @@ export declare namespace Matrix {
|
|
|
2451
2469
|
export function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
|
|
2452
2470
|
}
|
|
2453
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* @public
|
|
2474
|
+
*/
|
|
2475
|
+
export declare const MAX_ENTITY_NUMBER = 65535;
|
|
2476
|
+
|
|
2477
|
+
export declare const MAX_U16 = 65535;
|
|
2478
|
+
|
|
2454
2479
|
export declare const MeshCollider: MeshColliderComponentDefinitionExtended;
|
|
2455
2480
|
|
|
2456
2481
|
/**
|
|
@@ -3687,12 +3712,12 @@ export declare const PointerEventsResult: ComponentDefinition<PBPointerEventsRes
|
|
|
3687
3712
|
export declare type PointerEventsSystem = ReturnType<typeof createPointerEventSystem>;
|
|
3688
3713
|
|
|
3689
3714
|
export declare const pointerEventsSystem: {
|
|
3690
|
-
removeOnClick(entity:
|
|
3691
|
-
removeOnPointerDown(entity:
|
|
3692
|
-
removeOnPointerUp(entity:
|
|
3693
|
-
onClick(entity:
|
|
3694
|
-
onPointerDown(entity:
|
|
3695
|
-
onPointerUp(entity:
|
|
3715
|
+
removeOnClick(entity: Entity): void;
|
|
3716
|
+
removeOnPointerDown(entity: Entity): void;
|
|
3717
|
+
removeOnPointerUp(entity: Entity): void;
|
|
3718
|
+
onClick(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3719
|
+
onPointerDown(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3720
|
+
onPointerUp(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3696
3721
|
};
|
|
3697
3722
|
|
|
3698
3723
|
export declare const enum PointerEventType {
|
|
@@ -4055,6 +4080,11 @@ export declare type ReceiveMessage = {
|
|
|
4055
4080
|
messageBuffer: Uint8Array;
|
|
4056
4081
|
};
|
|
4057
4082
|
|
|
4083
|
+
/**
|
|
4084
|
+
* @public This first 512 entities are reserved by the renderer
|
|
4085
|
+
*/
|
|
4086
|
+
export declare const RESERVED_STATIC_ENTITIES = 512;
|
|
4087
|
+
|
|
4058
4088
|
export declare type RPCSendableMessage = {
|
|
4059
4089
|
jsonrpc: '2.0';
|
|
4060
4090
|
id: number;
|
|
@@ -4495,6 +4525,11 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4495
4525
|
/** @public */
|
|
4496
4526
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4497
4527
|
|
|
4528
|
+
/**
|
|
4529
|
+
* @public It only defines the type explicitly, no effects.
|
|
4530
|
+
*/
|
|
4531
|
+
export declare type uint32 = number;
|
|
4532
|
+
|
|
4498
4533
|
/** @public */
|
|
4499
4534
|
export declare const UiText: ComponentDefinition<PBUiText>;
|
|
4500
4535
|
|
package/dist/index.bundled.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _m0 from 'protobufjs/minimal';
|
|
2
2
|
|
|
3
|
+
export declare const AMOUNT_VERSION_AVAILABLE: number;
|
|
4
|
+
|
|
3
5
|
export declare const Animator: AnimatorComponentDefinitionExtended;
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -981,8 +983,8 @@ export declare type Color4Type = {
|
|
|
981
983
|
};
|
|
982
984
|
|
|
983
985
|
export declare type CommonProps = {
|
|
984
|
-
key
|
|
985
|
-
children
|
|
986
|
+
key?: Key;
|
|
987
|
+
children?: Children;
|
|
986
988
|
};
|
|
987
989
|
|
|
988
990
|
/**
|
|
@@ -1170,9 +1172,20 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1170
1172
|
};
|
|
1171
1173
|
|
|
1172
1174
|
/**
|
|
1173
|
-
* @public
|
|
1175
|
+
* @public The Entity is a number type, the cast is only for typescript, the final javascript code treat as a number
|
|
1176
|
+
* version number
|
|
1177
|
+
* [31...16][15...0]
|
|
1178
|
+
*
|
|
1179
|
+
* Convertion from entity to its compound numbers:
|
|
1180
|
+
* To get the version => ((entity & MASK_UPPER_16_ON_32) >> 16) & MAX_U16
|
|
1181
|
+
* To get the number => entity & MAX_U16
|
|
1182
|
+
*
|
|
1183
|
+
* Convertion from its compound numbers to entity:
|
|
1184
|
+
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1174
1185
|
*/
|
|
1175
|
-
export declare type Entity =
|
|
1186
|
+
export declare type Entity = uint32 & {
|
|
1187
|
+
__entity_type: '';
|
|
1188
|
+
};
|
|
1176
1189
|
|
|
1177
1190
|
export declare type EntityComponents = {
|
|
1178
1191
|
uiTransform: PBUiTransform;
|
|
@@ -1185,10 +1198,13 @@ export declare type EntityComponents = {
|
|
|
1185
1198
|
};
|
|
1186
1199
|
|
|
1187
1200
|
export declare function EntityContainer(): {
|
|
1188
|
-
generateEntity(
|
|
1201
|
+
generateEntity(): Entity;
|
|
1189
1202
|
removeEntity(entity: Entity): boolean;
|
|
1190
1203
|
entityExists(entity: Entity): boolean;
|
|
1191
1204
|
getExistingEntities(): Set<Entity>;
|
|
1205
|
+
entityVersion: (entity: Entity) => number;
|
|
1206
|
+
entityNumber: (entity: Entity) => number;
|
|
1207
|
+
entityId: (entityNumber: number, entityVersion: number) => Entity;
|
|
1192
1208
|
};
|
|
1193
1209
|
|
|
1194
1210
|
/**
|
|
@@ -1197,7 +1213,7 @@ export declare function EntityContainer(): {
|
|
|
1197
1213
|
export declare type EntityPropTypes = {
|
|
1198
1214
|
uiTransform?: UiTransformProps;
|
|
1199
1215
|
uiBackground?: UiBackgroundProps;
|
|
1200
|
-
} & Listeners
|
|
1216
|
+
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1201
1217
|
|
|
1202
1218
|
/**
|
|
1203
1219
|
* Constant used to define the minimal number value in Babylon.js
|
|
@@ -1683,6 +1699,8 @@ export declare type MapResult<T extends Spec> = ToOptional<{
|
|
|
1683
1699
|
[K in keyof T]: T[K] extends ISchema ? ReturnType<T[K]['deserialize']> : T[K] extends Spec ? MapResult<T[K]> : never;
|
|
1684
1700
|
}>;
|
|
1685
1701
|
|
|
1702
|
+
export declare const MASK_UPPER_16_ON_32 = 4294901760;
|
|
1703
|
+
|
|
1686
1704
|
export declare const Material: MaterialComponentDefinitionExtended;
|
|
1687
1705
|
|
|
1688
1706
|
/**
|
|
@@ -2451,6 +2469,13 @@ export declare namespace Matrix {
|
|
|
2451
2469
|
export function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
|
|
2452
2470
|
}
|
|
2453
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* @public
|
|
2474
|
+
*/
|
|
2475
|
+
export declare const MAX_ENTITY_NUMBER = 65535;
|
|
2476
|
+
|
|
2477
|
+
export declare const MAX_U16 = 65535;
|
|
2478
|
+
|
|
2454
2479
|
export declare const MeshCollider: MeshColliderComponentDefinitionExtended;
|
|
2455
2480
|
|
|
2456
2481
|
/**
|
|
@@ -3687,12 +3712,12 @@ export declare const PointerEventsResult: ComponentDefinition<PBPointerEventsRes
|
|
|
3687
3712
|
export declare type PointerEventsSystem = ReturnType<typeof createPointerEventSystem>;
|
|
3688
3713
|
|
|
3689
3714
|
export declare const pointerEventsSystem: {
|
|
3690
|
-
removeOnClick(entity:
|
|
3691
|
-
removeOnPointerDown(entity:
|
|
3692
|
-
removeOnPointerUp(entity:
|
|
3693
|
-
onClick(entity:
|
|
3694
|
-
onPointerDown(entity:
|
|
3695
|
-
onPointerUp(entity:
|
|
3715
|
+
removeOnClick(entity: Entity): void;
|
|
3716
|
+
removeOnPointerDown(entity: Entity): void;
|
|
3717
|
+
removeOnPointerUp(entity: Entity): void;
|
|
3718
|
+
onClick(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3719
|
+
onPointerDown(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3720
|
+
onPointerUp(entity: Entity, cb: EventSystemCallback, opts?: Partial<EventSystemOptions> | undefined): void;
|
|
3696
3721
|
};
|
|
3697
3722
|
|
|
3698
3723
|
export declare const enum PointerEventType {
|
|
@@ -4055,6 +4080,11 @@ export declare type ReceiveMessage = {
|
|
|
4055
4080
|
messageBuffer: Uint8Array;
|
|
4056
4081
|
};
|
|
4057
4082
|
|
|
4083
|
+
/**
|
|
4084
|
+
* @public This first 512 entities are reserved by the renderer
|
|
4085
|
+
*/
|
|
4086
|
+
export declare const RESERVED_STATIC_ENTITIES = 512;
|
|
4087
|
+
|
|
4058
4088
|
export declare type RPCSendableMessage = {
|
|
4059
4089
|
jsonrpc: '2.0';
|
|
4060
4090
|
id: number;
|
|
@@ -4495,6 +4525,11 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4495
4525
|
/** @public */
|
|
4496
4526
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4497
4527
|
|
|
4528
|
+
/**
|
|
4529
|
+
* @public It only defines the type explicitly, no effects.
|
|
4530
|
+
*/
|
|
4531
|
+
export declare type uint32 = number;
|
|
4532
|
+
|
|
4498
4533
|
/** @public */
|
|
4499
4534
|
export declare const UiText: ComponentDefinition<PBUiText>;
|
|
4500
4535
|
|
package/dist/index.js
CHANGED
|
@@ -14055,98 +14055,76 @@
|
|
|
14055
14055
|
};
|
|
14056
14056
|
}
|
|
14057
14057
|
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
];
|
|
14076
|
-
function isInRange(entity, range) {
|
|
14077
|
-
return entity >= range[0] && entity <= range[1];
|
|
14078
|
-
}
|
|
14079
|
-
// @internal
|
|
14080
|
-
function isDynamicEntity(entity) {
|
|
14081
|
-
return isInRange(entity, EntityUtils.DYNAMIC_ENTITIES_RANGE);
|
|
14058
|
+
const MAX_U16 = 0xffff;
|
|
14059
|
+
const MASK_UPPER_16_ON_32 = 0xffff0000;
|
|
14060
|
+
const AMOUNT_VERSION_AVAILABLE = MAX_U16 + 1;
|
|
14061
|
+
/**
|
|
14062
|
+
* @public This first 512 entities are reserved by the renderer
|
|
14063
|
+
*/
|
|
14064
|
+
const RESERVED_STATIC_ENTITIES = 512;
|
|
14065
|
+
/**
|
|
14066
|
+
* @public
|
|
14067
|
+
*/
|
|
14068
|
+
const MAX_ENTITY_NUMBER = MAX_U16;
|
|
14069
|
+
function EntityContainer() {
|
|
14070
|
+
let entityCounter = RESERVED_STATIC_ENTITIES;
|
|
14071
|
+
const usedEntities = new Set();
|
|
14072
|
+
const removedEntities = new Map();
|
|
14073
|
+
function entityVersion(entity) {
|
|
14074
|
+
return (((entity & MASK_UPPER_16_ON_32) >> 16) & MAX_U16) >>> 0;
|
|
14082
14075
|
}
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
return isInRange(entity, EntityUtils.STATIC_ENTITIES_RANGE);
|
|
14076
|
+
function entityNumber(entity) {
|
|
14077
|
+
return (entity & MAX_U16) >>> 0;
|
|
14086
14078
|
}
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14079
|
+
function entityId(entityNumber, entityVersion) {
|
|
14080
|
+
return (((entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)) >>>
|
|
14081
|
+
0);
|
|
14090
14082
|
}
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
function EntityContainer() {
|
|
14095
|
-
const staticEntity = Entity(EntityUtils.STATIC_ENTITIES_RANGE);
|
|
14096
|
-
const dynamicEntity = Entity(EntityUtils.DYNAMIC_ENTITIES_RANGE);
|
|
14097
|
-
return {
|
|
14098
|
-
generateEntity(dynamic = false) {
|
|
14099
|
-
/* istanbul ignore next */
|
|
14100
|
-
if (dynamic) {
|
|
14101
|
-
// Dynamic entities are not being used, but since we dont know the future of the dynamic entities
|
|
14102
|
-
// I prefer to comment the code instead of removing all the logic
|
|
14103
|
-
/* istanbul ignore next */
|
|
14104
|
-
return dynamicEntity.generateEntity();
|
|
14105
|
-
}
|
|
14106
|
-
else {
|
|
14107
|
-
return staticEntity.generateEntity();
|
|
14108
|
-
}
|
|
14109
|
-
},
|
|
14110
|
-
removeEntity(entity) {
|
|
14111
|
-
return (staticEntity.removeEntity(entity) || dynamicEntity.removeEntity(entity));
|
|
14112
|
-
},
|
|
14113
|
-
entityExists(entity) {
|
|
14114
|
-
return (EntityUtils.isReservedEntity(entity) ||
|
|
14115
|
-
staticEntity.getExistingEntities().has(entity) ||
|
|
14116
|
-
dynamicEntity.getExistingEntities().has(entity));
|
|
14117
|
-
},
|
|
14118
|
-
getExistingEntities() {
|
|
14119
|
-
return new Set([
|
|
14120
|
-
...staticEntity.getExistingEntities(),
|
|
14121
|
-
...dynamicEntity.getExistingEntities()
|
|
14122
|
-
]);
|
|
14083
|
+
function generateNewEntity() {
|
|
14084
|
+
if (entityCounter > MAX_ENTITY_NUMBER - 1) {
|
|
14085
|
+
throw new Error(`It fails trying to generate an entity out of range ${MAX_ENTITY_NUMBER}.`);
|
|
14123
14086
|
}
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
function Entity(range) {
|
|
14127
|
-
function createEntity(entity) {
|
|
14087
|
+
const entity = entityCounter++;
|
|
14088
|
+
usedEntities.add(entity);
|
|
14128
14089
|
return entity;
|
|
14129
14090
|
}
|
|
14130
|
-
let entityCounter = range[0];
|
|
14131
|
-
const usedEntities = new Set();
|
|
14132
14091
|
function generateEntity() {
|
|
14133
|
-
if (
|
|
14134
|
-
|
|
14092
|
+
if (usedEntities.size + RESERVED_STATIC_ENTITIES >= entityCounter) {
|
|
14093
|
+
return generateNewEntity();
|
|
14094
|
+
}
|
|
14095
|
+
for (const [number, version] of removedEntities) {
|
|
14096
|
+
if (version < MAX_U16) {
|
|
14097
|
+
const entity = entityId(number, version + 1);
|
|
14098
|
+
usedEntities.add(entity);
|
|
14099
|
+
removedEntities.delete(number);
|
|
14100
|
+
return entity;
|
|
14101
|
+
}
|
|
14135
14102
|
}
|
|
14136
|
-
|
|
14137
|
-
entityCounter++;
|
|
14138
|
-
usedEntities.add(entity);
|
|
14139
|
-
return entity;
|
|
14103
|
+
return generateNewEntity();
|
|
14140
14104
|
}
|
|
14141
14105
|
function removeEntity(entity) {
|
|
14142
|
-
|
|
14106
|
+
const deleted = usedEntities.delete(entity);
|
|
14107
|
+
if (deleted) {
|
|
14108
|
+
removedEntities.set(entityNumber(entity), entityVersion(entity));
|
|
14109
|
+
}
|
|
14110
|
+
return deleted;
|
|
14143
14111
|
}
|
|
14144
14112
|
return {
|
|
14113
|
+
generateEntity() {
|
|
14114
|
+
return generateEntity();
|
|
14115
|
+
},
|
|
14116
|
+
removeEntity(entity) {
|
|
14117
|
+
return removeEntity(entity);
|
|
14118
|
+
},
|
|
14119
|
+
entityExists(entity) {
|
|
14120
|
+
return entity < RESERVED_STATIC_ENTITIES || usedEntities.has(entity);
|
|
14121
|
+
},
|
|
14145
14122
|
getExistingEntities() {
|
|
14146
14123
|
return new Set(usedEntities);
|
|
14147
14124
|
},
|
|
14148
|
-
|
|
14149
|
-
|
|
14125
|
+
entityVersion,
|
|
14126
|
+
entityNumber,
|
|
14127
|
+
entityId
|
|
14150
14128
|
};
|
|
14151
14129
|
}
|
|
14152
14130
|
|
|
@@ -41180,6 +41158,7 @@
|
|
|
41180
41158
|
await pollEvents(EngineApi.sendBatch);
|
|
41181
41159
|
}
|
|
41182
41160
|
|
|
41161
|
+
exports.AMOUNT_VERSION_AVAILABLE = AMOUNT_VERSION_AVAILABLE;
|
|
41183
41162
|
exports.Animator = Animator;
|
|
41184
41163
|
exports.AudioSource = AudioSource;
|
|
41185
41164
|
exports.AudioStream = AudioStream;
|
|
@@ -41201,6 +41180,9 @@
|
|
|
41201
41180
|
exports.GltfContainer = GltfContainer;
|
|
41202
41181
|
exports.Input = Input;
|
|
41203
41182
|
exports.Label = Label;
|
|
41183
|
+
exports.MASK_UPPER_16_ON_32 = MASK_UPPER_16_ON_32;
|
|
41184
|
+
exports.MAX_ENTITY_NUMBER = MAX_ENTITY_NUMBER;
|
|
41185
|
+
exports.MAX_U16 = MAX_U16;
|
|
41204
41186
|
exports.Material = Material;
|
|
41205
41187
|
exports.MeshCollider = MeshCollider;
|
|
41206
41188
|
exports.MeshRenderer = MeshRenderer;
|
|
@@ -41255,6 +41237,7 @@
|
|
|
41255
41237
|
exports.PointerEventsResult = PointerEventsResult;
|
|
41256
41238
|
exports.PointerLock = PointerLock;
|
|
41257
41239
|
exports.RAD2DEG = RAD2DEG;
|
|
41240
|
+
exports.RESERVED_STATIC_ENTITIES = RESERVED_STATIC_ENTITIES;
|
|
41258
41241
|
exports.Raycast = Raycast;
|
|
41259
41242
|
exports.RaycastHit = RaycastHit;
|
|
41260
41243
|
exports.RaycastResult = RaycastResult;
|