@dcl/ecs 7.7.6 → 7.7.7-13655406288.commit-7b2a671

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 (34) hide show
  1. package/README.md +7 -115
  2. package/dist/components/extended/LightSource.d.ts +25 -0
  3. package/dist/components/extended/LightSource.js +22 -0
  4. package/dist/components/generated/LightSource.gen.d.ts +1 -0
  5. package/dist/components/generated/LightSource.gen.js +25 -0
  6. package/dist/components/generated/component-names.gen.js +1 -0
  7. package/dist/components/generated/global.gen.d.ts +2 -0
  8. package/dist/components/generated/global.gen.js +1 -0
  9. package/dist/components/generated/index.gen.d.ts +4 -0
  10. package/dist/components/generated/index.gen.js +5 -0
  11. package/dist/components/generated/pb/decentraland/sdk/components/light_source.gen.d.ts +75 -0
  12. package/dist/components/generated/pb/decentraland/sdk/components/light_source.gen.js +205 -0
  13. package/dist/components/index.d.ts +2 -0
  14. package/dist/components/index.js +3 -0
  15. package/dist/components/types.d.ts +1 -0
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.js +1 -0
  18. package/dist-cjs/components/extended/LightSource.d.ts +25 -0
  19. package/dist-cjs/components/extended/LightSource.js +26 -0
  20. package/dist-cjs/components/generated/LightSource.gen.d.ts +1 -0
  21. package/dist-cjs/components/generated/LightSource.gen.js +28 -0
  22. package/dist-cjs/components/generated/component-names.gen.js +1 -0
  23. package/dist-cjs/components/generated/global.gen.d.ts +2 -0
  24. package/dist-cjs/components/generated/global.gen.js +2 -1
  25. package/dist-cjs/components/generated/index.gen.d.ts +4 -0
  26. package/dist-cjs/components/generated/index.gen.js +7 -1
  27. package/dist-cjs/components/generated/pb/decentraland/sdk/components/light_source.gen.d.ts +75 -0
  28. package/dist-cjs/components/generated/pb/decentraland/sdk/components/light_source.gen.js +211 -0
  29. package/dist-cjs/components/index.d.ts +2 -0
  30. package/dist-cjs/components/index.js +5 -1
  31. package/dist-cjs/components/types.d.ts +1 -0
  32. package/dist-cjs/index.d.ts +2 -1
  33. package/dist-cjs/index.js +2 -1
  34. package/package.json +2 -2
package/README.md CHANGED
@@ -1,118 +1,10 @@
1
- # @dcl/ecs
1
+ # ECS 7
2
2
 
3
- Core Entity Component System (ECS) package for Decentraland scenes. Implements a CRDT-based ECS architecture for networked scene state.
3
+ ## Installing dependencies
4
+ Run `make install`, this will run the `npm install` and other dependencies
4
5
 
5
- ## Installation
6
+ ## Building
7
+ Run `make build`
6
8
 
7
- ```bash
8
- npm install @dcl/ecs
9
- ```
10
-
11
- ## Usage
12
-
13
- ```typescript
14
- import { engine } from '@dcl/ecs'
15
-
16
- // Create entity
17
- const entity = engine.addEntity()
18
-
19
- // Define and add component
20
- const Health = engine.defineComponent(1, {
21
- current: Number,
22
- max: Number,
23
- regeneration: Number
24
- })
25
-
26
- Health.create(entity, {
27
- current: 100,
28
- max: 100,
29
- regeneration: 1
30
- })
31
-
32
- // Create system
33
- engine.addSystem((dt: number) => {
34
- for (const [entity, health] of engine.mutableGroupOf(Health)) {
35
- if (health.current < health.max) {
36
- health.current = Math.min(health.max, health.current + health.regeneration * dt)
37
- }
38
- }
39
- })
40
- ```
41
-
42
- ## Technical Overview
43
-
44
- ### Component Definition
45
-
46
- Components are defined with a unique ID and a schema. The schema is used to:
47
-
48
- - Generate TypeScript types
49
- - Create binary serializers/deserializers
50
- - Set up CRDT operations
51
-
52
- ### CRDT Implementation
53
-
54
- The ECS uses CRDTs (Conflict-free Replicated Data Types) to enable deterministic state updates across multiple engine instances:
55
-
56
- - Component updates are CRDT operations with logical timestamps
57
- - Multiple engine instances can be synced by exchanging CRDT operations
58
- - Conflict resolution uses timestamps and entity IDs to ensure consistency
59
- - Binary transport format minimizes network overhead
60
-
61
- ### Network Entities
62
-
63
- For multiplayer scenes, the `syncEntity` method marks entities that should be synchronized across peers.
64
- In the background it creates a NetworkEntity and a SyncComponents components with all the info necessary to synchronise the entity through the network.
65
-
66
- ```typescript
67
- import { engine, NetworkEntity } from '@dcl/ecs'
68
-
69
- // Create a networked entity
70
- const foe = engine.addEntity()
71
- NetworkEntity.create(foe)
72
-
73
- // Components on this entity will be synced across peers
74
- Health.create(foe, { current: 100, max: 100, regeneration: 1 })
75
- ```
76
-
77
- Each peer maintains its own engine instance. When using NetworkEntity:
78
-
79
- - The owner peer can modify the entity's components
80
- - Other peers receive read-only replicas
81
- - Updates are propagated through the network transport layer using CRDT operations
82
-
83
- Example transport message:
84
-
85
- ```typescript
86
- {
87
- entityId: number
88
- componentId: number
89
- timestamp: number
90
- data: Uint8Array // Serialized component data
91
- }
92
- ```
93
-
94
- ### Performance Features
95
-
96
- - Zero-allocation component iteration
97
- - Dirty state tracking for efficient updates
98
- - Binary serialization for network transport
99
- - Batched component operations
100
-
101
- ## Development
102
-
103
- ```bash
104
- # Build
105
- make build
106
-
107
- # Test
108
- make test
109
-
110
- # Clean and reinstall
111
- make clean && make install
112
- ```
113
-
114
- ## Documentation
115
-
116
- - [ECS Guide](https://docs.decentraland.org/creator/development-guide/sdk7/entities-components/)
117
- - [Component Reference](https://docs.decentraland.org/creator/development-guide/sdk7/components/)
118
- - [ADR-117: CRDT Protocol](https://adr.decentraland.org/adr/ADR-117)
9
+ ## Testing
10
+ Run `make test`, you can also debug the test in VS code, selecting the launch `Jest current file` or just `Jest` (this will run all test)
@@ -0,0 +1,25 @@
1
+ import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
+ import { PBLightSource_Point, PBLightSource_Spot, PBLightSource } from '../generated/index.gen';
3
+ /**
4
+ * @public
5
+ */
6
+ export interface LightSourceHelper {
7
+ /**
8
+ * @returns a Light Source type
9
+ */
10
+ Point: (point: PBLightSource_Point) => PBLightSource['type'];
11
+ /**
12
+ * @returns a Light Source type
13
+ */
14
+ Spot: (spot: PBLightSource_Spot) => PBLightSource['type'];
15
+ }
16
+ /**
17
+ * @public
18
+ */
19
+ export interface LightSourceComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBLightSource> {
20
+ /**
21
+ * LightSource helper with constructor
22
+ */
23
+ Type: LightSourceHelper;
24
+ }
25
+ export declare function defineLightSourceComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): LightSourceComponentDefinitionExtended;
@@ -0,0 +1,22 @@
1
+ import { LightSource } from '../generated/index.gen';
2
+ const LightSourceHelper = {
3
+ Point(point) {
4
+ return {
5
+ $case: 'point',
6
+ point
7
+ };
8
+ },
9
+ Spot(spot) {
10
+ return {
11
+ $case: 'spot',
12
+ spot
13
+ };
14
+ }
15
+ };
16
+ export function defineLightSourceComponent(engine) {
17
+ const theComponent = LightSource(engine);
18
+ return {
19
+ ...theComponent,
20
+ Type: LightSourceHelper
21
+ };
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { PBLightSource } from './pb/decentraland/sdk/components/light_source.gen';
2
+ /**
3
+ * @internal
4
+ */
5
+ export const LightSourceSchema = {
6
+ COMPONENT_ID: 1079,
7
+ serialize(value, builder) {
8
+ const writer = PBLightSource.encode(value);
9
+ const buffer = new Uint8Array(writer.finish(), 0, writer.len);
10
+ builder.writeBuffer(buffer, false);
11
+ },
12
+ deserialize(reader) {
13
+ return PBLightSource.decode(reader.buffer(), reader.remainingBytes());
14
+ },
15
+ create() {
16
+ // TODO: this is a hack.
17
+ return PBLightSource.decode(new Uint8Array());
18
+ },
19
+ jsonSchema: {
20
+ type: "object",
21
+ properties: {},
22
+ serializationType: "protocol-buffer",
23
+ protocolBuffer: "PBLightSource"
24
+ }
25
+ };
@@ -20,6 +20,7 @@ export const coreComponentMappings = {
20
20
  "core::GltfContainer": 1041,
21
21
  "core::GltfContainerLoadingState": 1049,
22
22
  "core::InputModifier": 1078,
23
+ "core::LightSource": 1079,
23
24
  "core::MainCamera": 1075,
24
25
  "core::MapPin": 1097,
25
26
  "core::Material": 1017,
@@ -16,6 +16,7 @@ import { PBEngineInfo } from './pb/decentraland/sdk/components/engine_info.gen';
16
16
  import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
17
17
  import { PBGltfContainerLoadingState } from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
18
18
  import { PBInputModifier } from './pb/decentraland/sdk/components/input_modifier.gen';
19
+ import { PBLightSource } from './pb/decentraland/sdk/components/light_source.gen';
19
20
  import { PBMainCamera } from './pb/decentraland/sdk/components/main_camera.gen';
20
21
  import { PBNftShape } from './pb/decentraland/sdk/components/nft_shape.gen';
21
22
  import { PBPlayerIdentityData } from './pb/decentraland/sdk/components/player_identity_data.gen';
@@ -56,6 +57,7 @@ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibili
56
57
  /** @public */ export declare const GltfContainer: LastWriteWinElementSetComponentDefinition<PBGltfContainer>;
57
58
  /** @public */ export declare const GltfContainerLoadingState: LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>;
58
59
  /** @public */ export declare const InputModifier: LastWriteWinElementSetComponentDefinition<PBInputModifier>;
60
+ /** @public */ export declare const LightSource: LastWriteWinElementSetComponentDefinition<PBLightSource>;
59
61
  /** @public */ export declare const MainCamera: LastWriteWinElementSetComponentDefinition<PBMainCamera>;
60
62
  /** @public */ export declare const NftShape: LastWriteWinElementSetComponentDefinition<PBNftShape>;
61
63
  /** @public */ export declare const PlayerIdentityData: LastWriteWinElementSetComponentDefinition<PBPlayerIdentityData>;
@@ -17,6 +17,7 @@ export * from './index.gen';
17
17
  /** @public */ export const GltfContainer = /* @__PURE__ */ components.GltfContainer(engine);
18
18
  /** @public */ export const GltfContainerLoadingState = /* @__PURE__ */ components.GltfContainerLoadingState(engine);
19
19
  /** @public */ export const InputModifier = /* @__PURE__ */ components.InputModifier(engine);
20
+ /** @public */ export const LightSource = /* @__PURE__ */ components.LightSource(engine);
20
21
  /** @public */ export const MainCamera = /* @__PURE__ */ components.MainCamera(engine);
21
22
  /** @public */ export const NftShape = /* @__PURE__ */ components.NftShape(engine);
22
23
  /** @public */ export const PlayerIdentityData = /* @__PURE__ */ components.PlayerIdentityData(engine);
@@ -17,6 +17,7 @@ import { PBEngineInfo } from './pb/decentraland/sdk/components/engine_info.gen';
17
17
  import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
18
18
  import { PBGltfContainerLoadingState } from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
19
19
  import { PBInputModifier } from './pb/decentraland/sdk/components/input_modifier.gen';
20
+ import { PBLightSource } from './pb/decentraland/sdk/components/light_source.gen';
20
21
  import { PBMainCamera } from './pb/decentraland/sdk/components/main_camera.gen';
21
22
  import { PBMaterial } from './pb/decentraland/sdk/components/material.gen';
22
23
  import { PBMeshCollider } from './pb/decentraland/sdk/components/mesh_collider.gen';
@@ -62,6 +63,7 @@ export * from './pb/decentraland/sdk/components/engine_info.gen';
62
63
  export * from './pb/decentraland/sdk/components/gltf_container.gen';
63
64
  export * from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
64
65
  export * from './pb/decentraland/sdk/components/input_modifier.gen';
66
+ export * from './pb/decentraland/sdk/components/light_source.gen';
65
67
  export * from './pb/decentraland/sdk/components/main_camera.gen';
66
68
  export * from './pb/decentraland/sdk/components/material.gen';
67
69
  export * from './pb/decentraland/sdk/components/mesh_collider.gen';
@@ -109,6 +111,7 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
109
111
  /** @public */ export declare const GltfContainer: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
110
112
  /** @public */ export declare const GltfContainerLoadingState: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>>;
111
113
  /** @public */ export declare const InputModifier: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBInputModifier>>;
114
+ /** @public */ export declare const LightSource: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBLightSource>>;
112
115
  /** @public */ export declare const MainCamera: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMainCamera>>;
113
116
  /** @public */ export declare const Material: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
114
117
  /** @public */ export declare const MeshCollider: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
@@ -156,6 +159,7 @@ export declare const componentDefinitionByName: {
156
159
  "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
157
160
  "core::GltfContainerLoadingState": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>>;
158
161
  "core::InputModifier": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBInputModifier>>;
162
+ "core::LightSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBLightSource>>;
159
163
  "core::MainCamera": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMainCamera>>;
160
164
  "core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
161
165
  "core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
@@ -15,6 +15,7 @@ import { EngineInfoSchema } from './EngineInfo.gen';
15
15
  import { GltfContainerSchema } from './GltfContainer.gen';
16
16
  import { GltfContainerLoadingStateSchema } from './GltfContainerLoadingState.gen';
17
17
  import { InputModifierSchema } from './InputModifier.gen';
18
+ import { LightSourceSchema } from './LightSource.gen';
18
19
  import { MainCameraSchema } from './MainCamera.gen';
19
20
  import { MaterialSchema } from './Material.gen';
20
21
  import { MeshColliderSchema } from './MeshCollider.gen';
@@ -60,6 +61,7 @@ export * from './pb/decentraland/sdk/components/engine_info.gen';
60
61
  export * from './pb/decentraland/sdk/components/gltf_container.gen';
61
62
  export * from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
62
63
  export * from './pb/decentraland/sdk/components/input_modifier.gen';
64
+ export * from './pb/decentraland/sdk/components/light_source.gen';
63
65
  export * from './pb/decentraland/sdk/components/main_camera.gen';
64
66
  export * from './pb/decentraland/sdk/components/material.gen';
65
67
  export * from './pb/decentraland/sdk/components/mesh_collider.gen';
@@ -126,6 +128,8 @@ export * from './pb/decentraland/sdk/components/visibility_component.gen';
126
128
  /* @__PURE__ */ engine.defineComponentFromSchema("core::GltfContainerLoadingState", GltfContainerLoadingStateSchema);
127
129
  /** @public */ export const InputModifier = engine =>
128
130
  /* @__PURE__ */ engine.defineComponentFromSchema("core::InputModifier", InputModifierSchema);
131
+ /** @public */ export const LightSource = engine =>
132
+ /* @__PURE__ */ engine.defineComponentFromSchema("core::LightSource", LightSourceSchema);
129
133
  /** @public */ export const MainCamera = engine =>
130
134
  /* @__PURE__ */ engine.defineComponentFromSchema("core::MainCamera", MainCameraSchema);
131
135
  /** @public */ export const Material = engine =>
@@ -205,6 +209,7 @@ export const componentDefinitionByName = /* @__PURE__ */ {
205
209
  "core::GltfContainer": GltfContainer,
206
210
  "core::GltfContainerLoadingState": GltfContainerLoadingState,
207
211
  "core::InputModifier": InputModifier,
212
+ "core::LightSource": LightSource,
208
213
  "core::MainCamera": MainCamera,
209
214
  "core::Material": Material,
210
215
  "core::MeshCollider": MeshCollider,
@@ -0,0 +1,75 @@
1
+ import _m0 from "protobufjs/minimal";
2
+ import { Color3 } from "../../common/colors.gen";
3
+ import { TextureUnion } from "../../common/texture.gen";
4
+ /**
5
+ * @public
6
+ */
7
+ export interface PBLightSource {
8
+ /** default = true, whether the lightSource is active or not. */
9
+ active?: boolean | undefined;
10
+ /** default = Color.white, the tint of the light, in RGB format where each component is a floating point value with a range from 0 to 1. */
11
+ color?: Color3 | undefined;
12
+ /** default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. */
13
+ brightness?: number | undefined;
14
+ /** default = 10, how far the light travels, expressed in meters. */
15
+ range?: number | undefined;
16
+ type?: {
17
+ $case: "point";
18
+ point: PBLightSource_Point;
19
+ } | {
20
+ $case: "spot";
21
+ spot: PBLightSource_Spot;
22
+ } | undefined;
23
+ }
24
+ /**
25
+ * @public
26
+ */
27
+ export declare const enum PBLightSource_ShadowType {
28
+ /** ST_NONE - No shadows are cast from this LightSource. */
29
+ ST_NONE = 0,
30
+ /** ST_SOFT - More realistic type of shadow that reduces block artifacts, noise or pixelation, but requires more processing. */
31
+ ST_SOFT = 1,
32
+ /** ST_HARD - Less realistic type of shadow but more performant, uses hard edges. */
33
+ ST_HARD = 2
34
+ }
35
+ /**
36
+ * @public
37
+ */
38
+ export interface PBLightSource_Point {
39
+ /** default = ShadowType.ST_NONE The type of shadow the light source supports. */
40
+ shadow?: PBLightSource_ShadowType | undefined;
41
+ }
42
+ /**
43
+ * @public
44
+ */
45
+ export interface PBLightSource_Spot {
46
+ /** default = 21.8. Inner angle can't be higher than outer angle, otherwise will default to same value. Min value is 0. Max value is 179. */
47
+ innerAngle?: number | undefined;
48
+ /** default = 30. Outer angle can't be lower than inner angle, otherwise will inner angle will be set to same value. Max value is 179. */
49
+ outerAngle?: number | undefined;
50
+ /** default = ShadowType.ST_NONE The type of shadow the light source supports. */
51
+ shadow?: PBLightSource_ShadowType | undefined;
52
+ /** Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. */
53
+ shadowMaskTexture?: TextureUnion | undefined;
54
+ }
55
+ /**
56
+ * @public
57
+ */
58
+ export declare namespace PBLightSource {
59
+ function encode(message: PBLightSource, writer?: _m0.Writer): _m0.Writer;
60
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource;
61
+ }
62
+ /**
63
+ * @public
64
+ */
65
+ export declare namespace PBLightSource_Point {
66
+ function encode(message: PBLightSource_Point, writer?: _m0.Writer): _m0.Writer;
67
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Point;
68
+ }
69
+ /**
70
+ * @public
71
+ */
72
+ export declare namespace PBLightSource_Spot {
73
+ function encode(message: PBLightSource_Spot, writer?: _m0.Writer): _m0.Writer;
74
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Spot;
75
+ }
@@ -0,0 +1,205 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+ import { Color3 } from "../../common/colors.gen";
4
+ import { TextureUnion } from "../../common/texture.gen";
5
+ const protobufPackageSarasa = "decentraland.sdk.components";
6
+ /**
7
+ * @public
8
+ */
9
+ export var PBLightSource_ShadowType;
10
+ (function (PBLightSource_ShadowType) {
11
+ /** ST_NONE - No shadows are cast from this LightSource. */
12
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_NONE"] = 0] = "ST_NONE";
13
+ /** ST_SOFT - More realistic type of shadow that reduces block artifacts, noise or pixelation, but requires more processing. */
14
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_SOFT"] = 1] = "ST_SOFT";
15
+ /** ST_HARD - Less realistic type of shadow but more performant, uses hard edges. */
16
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_HARD"] = 2] = "ST_HARD";
17
+ })(PBLightSource_ShadowType || (PBLightSource_ShadowType = {}));
18
+ function createBasePBLightSource() {
19
+ return { active: undefined, color: undefined, brightness: undefined, range: undefined, type: undefined };
20
+ }
21
+ /**
22
+ * @public
23
+ */
24
+ export var PBLightSource;
25
+ (function (PBLightSource) {
26
+ function encode(message, writer = _m0.Writer.create()) {
27
+ if (message.active !== undefined) {
28
+ writer.uint32(32).bool(message.active);
29
+ }
30
+ if (message.color !== undefined) {
31
+ Color3.encode(message.color, writer.uint32(10).fork()).ldelim();
32
+ }
33
+ if (message.brightness !== undefined) {
34
+ writer.uint32(21).float(message.brightness);
35
+ }
36
+ if (message.range !== undefined) {
37
+ writer.uint32(29).float(message.range);
38
+ }
39
+ switch (message.type?.$case) {
40
+ case "point":
41
+ PBLightSource_Point.encode(message.type.point, writer.uint32(50).fork()).ldelim();
42
+ break;
43
+ case "spot":
44
+ PBLightSource_Spot.encode(message.type.spot, writer.uint32(58).fork()).ldelim();
45
+ break;
46
+ }
47
+ return writer;
48
+ }
49
+ PBLightSource.encode = encode;
50
+ function decode(input, length) {
51
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
52
+ let end = length === undefined ? reader.len : reader.pos + length;
53
+ const message = createBasePBLightSource();
54
+ while (reader.pos < end) {
55
+ const tag = reader.uint32();
56
+ switch (tag >>> 3) {
57
+ case 4:
58
+ if (tag !== 32) {
59
+ break;
60
+ }
61
+ message.active = reader.bool();
62
+ continue;
63
+ case 1:
64
+ if (tag !== 10) {
65
+ break;
66
+ }
67
+ message.color = Color3.decode(reader, reader.uint32());
68
+ continue;
69
+ case 2:
70
+ if (tag !== 21) {
71
+ break;
72
+ }
73
+ message.brightness = reader.float();
74
+ continue;
75
+ case 3:
76
+ if (tag !== 29) {
77
+ break;
78
+ }
79
+ message.range = reader.float();
80
+ continue;
81
+ case 6:
82
+ if (tag !== 50) {
83
+ break;
84
+ }
85
+ message.type = { $case: "point", point: PBLightSource_Point.decode(reader, reader.uint32()) };
86
+ continue;
87
+ case 7:
88
+ if (tag !== 58) {
89
+ break;
90
+ }
91
+ message.type = { $case: "spot", spot: PBLightSource_Spot.decode(reader, reader.uint32()) };
92
+ continue;
93
+ }
94
+ if ((tag & 7) === 4 || tag === 0) {
95
+ break;
96
+ }
97
+ reader.skipType(tag & 7);
98
+ }
99
+ return message;
100
+ }
101
+ PBLightSource.decode = decode;
102
+ })(PBLightSource || (PBLightSource = {}));
103
+ function createBasePBLightSource_Point() {
104
+ return { shadow: undefined };
105
+ }
106
+ /**
107
+ * @public
108
+ */
109
+ export var PBLightSource_Point;
110
+ (function (PBLightSource_Point) {
111
+ function encode(message, writer = _m0.Writer.create()) {
112
+ if (message.shadow !== undefined) {
113
+ writer.uint32(40).int32(message.shadow);
114
+ }
115
+ return writer;
116
+ }
117
+ PBLightSource_Point.encode = encode;
118
+ function decode(input, length) {
119
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
120
+ let end = length === undefined ? reader.len : reader.pos + length;
121
+ const message = createBasePBLightSource_Point();
122
+ while (reader.pos < end) {
123
+ const tag = reader.uint32();
124
+ switch (tag >>> 3) {
125
+ case 5:
126
+ if (tag !== 40) {
127
+ break;
128
+ }
129
+ message.shadow = reader.int32();
130
+ continue;
131
+ }
132
+ if ((tag & 7) === 4 || tag === 0) {
133
+ break;
134
+ }
135
+ reader.skipType(tag & 7);
136
+ }
137
+ return message;
138
+ }
139
+ PBLightSource_Point.decode = decode;
140
+ })(PBLightSource_Point || (PBLightSource_Point = {}));
141
+ function createBasePBLightSource_Spot() {
142
+ return { innerAngle: undefined, outerAngle: undefined, shadow: undefined, shadowMaskTexture: undefined };
143
+ }
144
+ /**
145
+ * @public
146
+ */
147
+ export var PBLightSource_Spot;
148
+ (function (PBLightSource_Spot) {
149
+ function encode(message, writer = _m0.Writer.create()) {
150
+ if (message.innerAngle !== undefined) {
151
+ writer.uint32(13).float(message.innerAngle);
152
+ }
153
+ if (message.outerAngle !== undefined) {
154
+ writer.uint32(21).float(message.outerAngle);
155
+ }
156
+ if (message.shadow !== undefined) {
157
+ writer.uint32(40).int32(message.shadow);
158
+ }
159
+ if (message.shadowMaskTexture !== undefined) {
160
+ TextureUnion.encode(message.shadowMaskTexture, writer.uint32(66).fork()).ldelim();
161
+ }
162
+ return writer;
163
+ }
164
+ PBLightSource_Spot.encode = encode;
165
+ function decode(input, length) {
166
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
167
+ let end = length === undefined ? reader.len : reader.pos + length;
168
+ const message = createBasePBLightSource_Spot();
169
+ while (reader.pos < end) {
170
+ const tag = reader.uint32();
171
+ switch (tag >>> 3) {
172
+ case 1:
173
+ if (tag !== 13) {
174
+ break;
175
+ }
176
+ message.innerAngle = reader.float();
177
+ continue;
178
+ case 2:
179
+ if (tag !== 21) {
180
+ break;
181
+ }
182
+ message.outerAngle = reader.float();
183
+ continue;
184
+ case 5:
185
+ if (tag !== 40) {
186
+ break;
187
+ }
188
+ message.shadow = reader.int32();
189
+ continue;
190
+ case 8:
191
+ if (tag !== 66) {
192
+ break;
193
+ }
194
+ message.shadowMaskTexture = TextureUnion.decode(reader, reader.uint32());
195
+ continue;
196
+ }
197
+ if ((tag & 7) === 4 || tag === 0) {
198
+ break;
199
+ }
200
+ reader.skipType(tag & 7);
201
+ }
202
+ return message;
203
+ }
204
+ PBLightSource_Spot.decode = decode;
205
+ })(PBLightSource_Spot || (PBLightSource_Spot = {}));
@@ -16,6 +16,7 @@ import { AudioStreamComponentDefinitionExtended } from './extended/AudioStream';
16
16
  import { MediaState } from './generated/pb/decentraland/sdk/components/common/media_state.gen';
17
17
  import { VirtualCameraComponentDefinitionExtended } from './extended/VirtualCamera';
18
18
  import { InputModifierComponentDefinitionExtended } from './extended/InputModifier';
19
+ import { LightSourceComponentDefinitionExtended } from './extended/LightSource';
19
20
  export * from './generated/index.gen';
20
21
  export type { GrowOnlyValueSetComponentDefinition, LastWriteWinElementSetComponentDefinition, LwwComponentGetter, GSetComponentGetter };
21
22
  export declare const Transform: LwwComponentGetter<TransformComponentExtended>;
@@ -28,6 +29,7 @@ export declare const MeshCollider: LwwComponentGetter<MeshColliderComponentDefin
28
29
  export declare const Tween: LwwComponentGetter<TweenComponentDefinitionExtended>;
29
30
  export declare const VirtualCamera: LwwComponentGetter<VirtualCameraComponentDefinitionExtended>;
30
31
  export declare const InputModifier: LwwComponentGetter<InputModifierComponentDefinitionExtended>;
32
+ export declare const LightSource: LwwComponentGetter<LightSourceComponentDefinitionExtended>;
31
33
  /**
32
34
  * @alpha
33
35
  */
@@ -13,6 +13,7 @@ import { defineAudioStreamComponent } from './extended/AudioStream';
13
13
  import { MediaState } from './generated/pb/decentraland/sdk/components/common/media_state.gen';
14
14
  import { defineVirtualCameraComponent } from './extended/VirtualCamera';
15
15
  import { defineInputModifierComponent } from './extended/InputModifier';
16
+ import { defineLightSourceComponent } from './extended/LightSource';
16
17
  export * from './generated/index.gen';
17
18
  /* @__PURE__ */
18
19
  export const Transform = (engine) => defineTransformComponent(engine);
@@ -34,6 +35,8 @@ export const Tween = (engine) => defineTweenComponent(engine);
34
35
  export const VirtualCamera = (engine) => defineVirtualCameraComponent(engine);
35
36
  /* @__PURE__*/
36
37
  export const InputModifier = (engine) => defineInputModifierComponent(engine);
38
+ /* @__PURE__*/
39
+ export const LightSource = (engine) => defineLightSourceComponent(engine);
37
40
  /**
38
41
  * @alpha
39
42
  */
@@ -12,3 +12,4 @@ export type { ISyncComponents, ISyncComponentsType } from './manual/SyncComponen
12
12
  export type { INetowrkEntity, INetowrkEntityType } from './manual/NetworkEntity';
13
13
  export type { INetowrkParent, INetowrkParentType } from './manual/NetworkParent';
14
14
  export type { InputModifierHelper, InputModifierComponentDefinitionExtended } from './extended/InputModifier';
15
+ export type { LightSourceHelper, LightSourceComponentDefinitionExtended } from './extended/LightSource';
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export * from './systems/async-task';
11
11
  export * from './systems/tween';
12
12
  export * from './engine/entity';
13
13
  export * from './components/types';
14
- import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended } from './components/types';
14
+ import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended, LightSourceComponentDefinitionExtended } from './components/types';
15
15
  import { NameComponent } from './components/manual/Name';
16
16
  export declare const Transform: TransformComponentExtended;
17
17
  export declare const Animator: AnimatorComponentDefinitionExtended;
@@ -24,6 +24,7 @@ export declare const Name: NameComponent;
24
24
  export declare const Tween: TweenComponentDefinitionExtended;
25
25
  export declare const VirtualCamera: VirtualCameraComponentDefinitionExtended;
26
26
  export declare const InputModifier: InputModifierComponentDefinitionExtended;
27
+ export declare const LightSource: LightSourceComponentDefinitionExtended;
27
28
  /**
28
29
  * @alpha
29
30
  * This is going to be used for sync components through a server.
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export const Name = components.Name(engine);
29
29
  export const Tween = /* @__PURE__*/ components.Tween(engine);
30
30
  export const VirtualCamera = /* @__PURE__*/ components.VirtualCamera(engine);
31
31
  export const InputModifier = /* @__PURE__*/ components.InputModifier(engine);
32
+ export const LightSource = /* @__PURE__*/ components.LightSource(engine);
32
33
  /**
33
34
  * @alpha
34
35
  * This is going to be used for sync components through a server.
@@ -0,0 +1,25 @@
1
+ import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
+ import { PBLightSource_Point, PBLightSource_Spot, PBLightSource } from '../generated/index.gen';
3
+ /**
4
+ * @public
5
+ */
6
+ export interface LightSourceHelper {
7
+ /**
8
+ * @returns a Light Source type
9
+ */
10
+ Point: (point: PBLightSource_Point) => PBLightSource['type'];
11
+ /**
12
+ * @returns a Light Source type
13
+ */
14
+ Spot: (spot: PBLightSource_Spot) => PBLightSource['type'];
15
+ }
16
+ /**
17
+ * @public
18
+ */
19
+ export interface LightSourceComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBLightSource> {
20
+ /**
21
+ * LightSource helper with constructor
22
+ */
23
+ Type: LightSourceHelper;
24
+ }
25
+ export declare function defineLightSourceComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): LightSourceComponentDefinitionExtended;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineLightSourceComponent = void 0;
4
+ const index_gen_1 = require("../generated/index.gen");
5
+ const LightSourceHelper = {
6
+ Point(point) {
7
+ return {
8
+ $case: 'point',
9
+ point
10
+ };
11
+ },
12
+ Spot(spot) {
13
+ return {
14
+ $case: 'spot',
15
+ spot
16
+ };
17
+ }
18
+ };
19
+ function defineLightSourceComponent(engine) {
20
+ const theComponent = (0, index_gen_1.LightSource)(engine);
21
+ return {
22
+ ...theComponent,
23
+ Type: LightSourceHelper
24
+ };
25
+ }
26
+ exports.defineLightSourceComponent = defineLightSourceComponent;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LightSourceSchema = void 0;
4
+ const light_source_gen_1 = require("./pb/decentraland/sdk/components/light_source.gen");
5
+ /**
6
+ * @internal
7
+ */
8
+ exports.LightSourceSchema = {
9
+ COMPONENT_ID: 1079,
10
+ serialize(value, builder) {
11
+ const writer = light_source_gen_1.PBLightSource.encode(value);
12
+ const buffer = new Uint8Array(writer.finish(), 0, writer.len);
13
+ builder.writeBuffer(buffer, false);
14
+ },
15
+ deserialize(reader) {
16
+ return light_source_gen_1.PBLightSource.decode(reader.buffer(), reader.remainingBytes());
17
+ },
18
+ create() {
19
+ // TODO: this is a hack.
20
+ return light_source_gen_1.PBLightSource.decode(new Uint8Array());
21
+ },
22
+ jsonSchema: {
23
+ type: "object",
24
+ properties: {},
25
+ serializationType: "protocol-buffer",
26
+ protocolBuffer: "PBLightSource"
27
+ }
28
+ };
@@ -23,6 +23,7 @@ exports.coreComponentMappings = {
23
23
  "core::GltfContainer": 1041,
24
24
  "core::GltfContainerLoadingState": 1049,
25
25
  "core::InputModifier": 1078,
26
+ "core::LightSource": 1079,
26
27
  "core::MainCamera": 1075,
27
28
  "core::MapPin": 1097,
28
29
  "core::Material": 1017,
@@ -16,6 +16,7 @@ import { PBEngineInfo } from './pb/decentraland/sdk/components/engine_info.gen';
16
16
  import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
17
17
  import { PBGltfContainerLoadingState } from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
18
18
  import { PBInputModifier } from './pb/decentraland/sdk/components/input_modifier.gen';
19
+ import { PBLightSource } from './pb/decentraland/sdk/components/light_source.gen';
19
20
  import { PBMainCamera } from './pb/decentraland/sdk/components/main_camera.gen';
20
21
  import { PBNftShape } from './pb/decentraland/sdk/components/nft_shape.gen';
21
22
  import { PBPlayerIdentityData } from './pb/decentraland/sdk/components/player_identity_data.gen';
@@ -56,6 +57,7 @@ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibili
56
57
  /** @public */ export declare const GltfContainer: LastWriteWinElementSetComponentDefinition<PBGltfContainer>;
57
58
  /** @public */ export declare const GltfContainerLoadingState: LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>;
58
59
  /** @public */ export declare const InputModifier: LastWriteWinElementSetComponentDefinition<PBInputModifier>;
60
+ /** @public */ export declare const LightSource: LastWriteWinElementSetComponentDefinition<PBLightSource>;
59
61
  /** @public */ export declare const MainCamera: LastWriteWinElementSetComponentDefinition<PBMainCamera>;
60
62
  /** @public */ export declare const NftShape: LastWriteWinElementSetComponentDefinition<PBNftShape>;
61
63
  /** @public */ export declare const PlayerIdentityData: LastWriteWinElementSetComponentDefinition<PBPlayerIdentityData>;
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.TextShape = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MainCamera = exports.InputModifier = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = void 0;
29
+ exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.TextShape = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MainCamera = exports.LightSource = exports.InputModifier = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = void 0;
30
30
  const initialization_1 = require("../../runtime/initialization");
31
31
  const components = __importStar(require("./index.gen"));
32
32
  __exportStar(require("./index.gen"), exports);
@@ -46,6 +46,7 @@ __exportStar(require("./index.gen"), exports);
46
46
  /** @public */ exports.GltfContainer = components.GltfContainer(initialization_1.engine);
47
47
  /** @public */ exports.GltfContainerLoadingState = components.GltfContainerLoadingState(initialization_1.engine);
48
48
  /** @public */ exports.InputModifier = components.InputModifier(initialization_1.engine);
49
+ /** @public */ exports.LightSource = components.LightSource(initialization_1.engine);
49
50
  /** @public */ exports.MainCamera = components.MainCamera(initialization_1.engine);
50
51
  /** @public */ exports.NftShape = components.NftShape(initialization_1.engine);
51
52
  /** @public */ exports.PlayerIdentityData = components.PlayerIdentityData(initialization_1.engine);
@@ -17,6 +17,7 @@ import { PBEngineInfo } from './pb/decentraland/sdk/components/engine_info.gen';
17
17
  import { PBGltfContainer } from './pb/decentraland/sdk/components/gltf_container.gen';
18
18
  import { PBGltfContainerLoadingState } from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
19
19
  import { PBInputModifier } from './pb/decentraland/sdk/components/input_modifier.gen';
20
+ import { PBLightSource } from './pb/decentraland/sdk/components/light_source.gen';
20
21
  import { PBMainCamera } from './pb/decentraland/sdk/components/main_camera.gen';
21
22
  import { PBMaterial } from './pb/decentraland/sdk/components/material.gen';
22
23
  import { PBMeshCollider } from './pb/decentraland/sdk/components/mesh_collider.gen';
@@ -62,6 +63,7 @@ export * from './pb/decentraland/sdk/components/engine_info.gen';
62
63
  export * from './pb/decentraland/sdk/components/gltf_container.gen';
63
64
  export * from './pb/decentraland/sdk/components/gltf_container_loading_state.gen';
64
65
  export * from './pb/decentraland/sdk/components/input_modifier.gen';
66
+ export * from './pb/decentraland/sdk/components/light_source.gen';
65
67
  export * from './pb/decentraland/sdk/components/main_camera.gen';
66
68
  export * from './pb/decentraland/sdk/components/material.gen';
67
69
  export * from './pb/decentraland/sdk/components/mesh_collider.gen';
@@ -109,6 +111,7 @@ export type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<an
109
111
  /** @public */ export declare const GltfContainer: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
110
112
  /** @public */ export declare const GltfContainerLoadingState: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>>;
111
113
  /** @public */ export declare const InputModifier: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBInputModifier>>;
114
+ /** @public */ export declare const LightSource: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBLightSource>>;
112
115
  /** @public */ export declare const MainCamera: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMainCamera>>;
113
116
  /** @public */ export declare const Material: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
114
117
  /** @public */ export declare const MeshCollider: LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
@@ -156,6 +159,7 @@ export declare const componentDefinitionByName: {
156
159
  "core::GltfContainer": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainer>>;
157
160
  "core::GltfContainerLoadingState": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBGltfContainerLoadingState>>;
158
161
  "core::InputModifier": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBInputModifier>>;
162
+ "core::LightSource": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBLightSource>>;
159
163
  "core::MainCamera": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMainCamera>>;
160
164
  "core::Material": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMaterial>>;
161
165
  "core::MeshCollider": LwwComponentGetter<LastWriteWinElementSetComponentDefinition<PBMeshCollider>>;
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.componentDefinitionByName = exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.Tween = exports.TextShape = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MeshRenderer = exports.MeshCollider = exports.Material = exports.MainCamera = exports.InputModifier = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = exports.Animator = void 0;
17
+ exports.componentDefinitionByName = exports.VisibilityComponent = exports.VirtualCamera = exports.VideoPlayer = exports.VideoEvent = exports.UiTransform = exports.UiText = exports.UiInputResult = exports.UiInput = exports.UiDropdownResult = exports.UiDropdown = exports.UiCanvasInformation = exports.UiBackground = exports.TweenState = exports.TweenSequence = exports.Tween = exports.TextShape = exports.RealmInfo = exports.RaycastResult = exports.Raycast = exports.PointerLock = exports.PointerEventsResult = exports.PointerEvents = exports.PlayerIdentityData = exports.NftShape = exports.MeshRenderer = exports.MeshCollider = exports.Material = exports.MainCamera = exports.LightSource = exports.InputModifier = exports.GltfContainerLoadingState = exports.GltfContainer = exports.EngineInfo = exports.CameraModeArea = exports.CameraMode = exports.Billboard = exports.AvatarShape = exports.AvatarModifierArea = exports.AvatarEquippedData = exports.AvatarEmoteCommand = exports.AvatarBase = exports.AvatarAttach = exports.AudioStream = exports.AudioSource = exports.AudioEvent = exports.Animator = void 0;
18
18
  const Animator_gen_1 = require("./Animator.gen");
19
19
  const AudioEvent_gen_1 = require("./AudioEvent.gen");
20
20
  const AudioSource_gen_1 = require("./AudioSource.gen");
@@ -32,6 +32,7 @@ const EngineInfo_gen_1 = require("./EngineInfo.gen");
32
32
  const GltfContainer_gen_1 = require("./GltfContainer.gen");
33
33
  const GltfContainerLoadingState_gen_1 = require("./GltfContainerLoadingState.gen");
34
34
  const InputModifier_gen_1 = require("./InputModifier.gen");
35
+ const LightSource_gen_1 = require("./LightSource.gen");
35
36
  const MainCamera_gen_1 = require("./MainCamera.gen");
36
37
  const Material_gen_1 = require("./Material.gen");
37
38
  const MeshCollider_gen_1 = require("./MeshCollider.gen");
@@ -77,6 +78,7 @@ __exportStar(require("./pb/decentraland/sdk/components/engine_info.gen"), export
77
78
  __exportStar(require("./pb/decentraland/sdk/components/gltf_container.gen"), exports);
78
79
  __exportStar(require("./pb/decentraland/sdk/components/gltf_container_loading_state.gen"), exports);
79
80
  __exportStar(require("./pb/decentraland/sdk/components/input_modifier.gen"), exports);
81
+ __exportStar(require("./pb/decentraland/sdk/components/light_source.gen"), exports);
80
82
  __exportStar(require("./pb/decentraland/sdk/components/main_camera.gen"), exports);
81
83
  __exportStar(require("./pb/decentraland/sdk/components/material.gen"), exports);
82
84
  __exportStar(require("./pb/decentraland/sdk/components/mesh_collider.gen"), exports);
@@ -160,6 +162,9 @@ exports.GltfContainerLoadingState = GltfContainerLoadingState;
160
162
  /** @public */ const InputModifier = engine =>
161
163
  /* @__PURE__ */ engine.defineComponentFromSchema("core::InputModifier", InputModifier_gen_1.InputModifierSchema);
162
164
  exports.InputModifier = InputModifier;
165
+ /** @public */ const LightSource = engine =>
166
+ /* @__PURE__ */ engine.defineComponentFromSchema("core::LightSource", LightSource_gen_1.LightSourceSchema);
167
+ exports.LightSource = LightSource;
163
168
  /** @public */ const MainCamera = engine =>
164
169
  /* @__PURE__ */ engine.defineComponentFromSchema("core::MainCamera", MainCamera_gen_1.MainCameraSchema);
165
170
  exports.MainCamera = MainCamera;
@@ -267,6 +272,7 @@ exports.componentDefinitionByName = {
267
272
  "core::GltfContainer": exports.GltfContainer,
268
273
  "core::GltfContainerLoadingState": exports.GltfContainerLoadingState,
269
274
  "core::InputModifier": exports.InputModifier,
275
+ "core::LightSource": exports.LightSource,
270
276
  "core::MainCamera": exports.MainCamera,
271
277
  "core::Material": exports.Material,
272
278
  "core::MeshCollider": exports.MeshCollider,
@@ -0,0 +1,75 @@
1
+ import _m0 from "protobufjs/minimal";
2
+ import { Color3 } from "../../common/colors.gen";
3
+ import { TextureUnion } from "../../common/texture.gen";
4
+ /**
5
+ * @public
6
+ */
7
+ export interface PBLightSource {
8
+ /** default = true, whether the lightSource is active or not. */
9
+ active?: boolean | undefined;
10
+ /** default = Color.white, the tint of the light, in RGB format where each component is a floating point value with a range from 0 to 1. */
11
+ color?: Color3 | undefined;
12
+ /** default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. */
13
+ brightness?: number | undefined;
14
+ /** default = 10, how far the light travels, expressed in meters. */
15
+ range?: number | undefined;
16
+ type?: {
17
+ $case: "point";
18
+ point: PBLightSource_Point;
19
+ } | {
20
+ $case: "spot";
21
+ spot: PBLightSource_Spot;
22
+ } | undefined;
23
+ }
24
+ /**
25
+ * @public
26
+ */
27
+ export declare const enum PBLightSource_ShadowType {
28
+ /** ST_NONE - No shadows are cast from this LightSource. */
29
+ ST_NONE = 0,
30
+ /** ST_SOFT - More realistic type of shadow that reduces block artifacts, noise or pixelation, but requires more processing. */
31
+ ST_SOFT = 1,
32
+ /** ST_HARD - Less realistic type of shadow but more performant, uses hard edges. */
33
+ ST_HARD = 2
34
+ }
35
+ /**
36
+ * @public
37
+ */
38
+ export interface PBLightSource_Point {
39
+ /** default = ShadowType.ST_NONE The type of shadow the light source supports. */
40
+ shadow?: PBLightSource_ShadowType | undefined;
41
+ }
42
+ /**
43
+ * @public
44
+ */
45
+ export interface PBLightSource_Spot {
46
+ /** default = 21.8. Inner angle can't be higher than outer angle, otherwise will default to same value. Min value is 0. Max value is 179. */
47
+ innerAngle?: number | undefined;
48
+ /** default = 30. Outer angle can't be lower than inner angle, otherwise will inner angle will be set to same value. Max value is 179. */
49
+ outerAngle?: number | undefined;
50
+ /** default = ShadowType.ST_NONE The type of shadow the light source supports. */
51
+ shadow?: PBLightSource_ShadowType | undefined;
52
+ /** Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. */
53
+ shadowMaskTexture?: TextureUnion | undefined;
54
+ }
55
+ /**
56
+ * @public
57
+ */
58
+ export declare namespace PBLightSource {
59
+ function encode(message: PBLightSource, writer?: _m0.Writer): _m0.Writer;
60
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource;
61
+ }
62
+ /**
63
+ * @public
64
+ */
65
+ export declare namespace PBLightSource_Point {
66
+ function encode(message: PBLightSource_Point, writer?: _m0.Writer): _m0.Writer;
67
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Point;
68
+ }
69
+ /**
70
+ * @public
71
+ */
72
+ export declare namespace PBLightSource_Spot {
73
+ function encode(message: PBLightSource_Spot, writer?: _m0.Writer): _m0.Writer;
74
+ function decode(input: _m0.Reader | Uint8Array, length?: number): PBLightSource_Spot;
75
+ }
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PBLightSource_Spot = exports.PBLightSource_Point = exports.PBLightSource = exports.PBLightSource_ShadowType = void 0;
7
+ /* eslint-disable */
8
+ const minimal_1 = __importDefault(require("protobufjs/minimal"));
9
+ const colors_gen_1 = require("../../common/colors.gen");
10
+ const texture_gen_1 = require("../../common/texture.gen");
11
+ const protobufPackageSarasa = "decentraland.sdk.components";
12
+ /**
13
+ * @public
14
+ */
15
+ var PBLightSource_ShadowType;
16
+ (function (PBLightSource_ShadowType) {
17
+ /** ST_NONE - No shadows are cast from this LightSource. */
18
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_NONE"] = 0] = "ST_NONE";
19
+ /** ST_SOFT - More realistic type of shadow that reduces block artifacts, noise or pixelation, but requires more processing. */
20
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_SOFT"] = 1] = "ST_SOFT";
21
+ /** ST_HARD - Less realistic type of shadow but more performant, uses hard edges. */
22
+ PBLightSource_ShadowType[PBLightSource_ShadowType["ST_HARD"] = 2] = "ST_HARD";
23
+ })(PBLightSource_ShadowType = exports.PBLightSource_ShadowType || (exports.PBLightSource_ShadowType = {}));
24
+ function createBasePBLightSource() {
25
+ return { active: undefined, color: undefined, brightness: undefined, range: undefined, type: undefined };
26
+ }
27
+ /**
28
+ * @public
29
+ */
30
+ var PBLightSource;
31
+ (function (PBLightSource) {
32
+ function encode(message, writer = minimal_1.default.Writer.create()) {
33
+ if (message.active !== undefined) {
34
+ writer.uint32(32).bool(message.active);
35
+ }
36
+ if (message.color !== undefined) {
37
+ colors_gen_1.Color3.encode(message.color, writer.uint32(10).fork()).ldelim();
38
+ }
39
+ if (message.brightness !== undefined) {
40
+ writer.uint32(21).float(message.brightness);
41
+ }
42
+ if (message.range !== undefined) {
43
+ writer.uint32(29).float(message.range);
44
+ }
45
+ switch (message.type?.$case) {
46
+ case "point":
47
+ PBLightSource_Point.encode(message.type.point, writer.uint32(50).fork()).ldelim();
48
+ break;
49
+ case "spot":
50
+ PBLightSource_Spot.encode(message.type.spot, writer.uint32(58).fork()).ldelim();
51
+ break;
52
+ }
53
+ return writer;
54
+ }
55
+ PBLightSource.encode = encode;
56
+ function decode(input, length) {
57
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
58
+ let end = length === undefined ? reader.len : reader.pos + length;
59
+ const message = createBasePBLightSource();
60
+ while (reader.pos < end) {
61
+ const tag = reader.uint32();
62
+ switch (tag >>> 3) {
63
+ case 4:
64
+ if (tag !== 32) {
65
+ break;
66
+ }
67
+ message.active = reader.bool();
68
+ continue;
69
+ case 1:
70
+ if (tag !== 10) {
71
+ break;
72
+ }
73
+ message.color = colors_gen_1.Color3.decode(reader, reader.uint32());
74
+ continue;
75
+ case 2:
76
+ if (tag !== 21) {
77
+ break;
78
+ }
79
+ message.brightness = reader.float();
80
+ continue;
81
+ case 3:
82
+ if (tag !== 29) {
83
+ break;
84
+ }
85
+ message.range = reader.float();
86
+ continue;
87
+ case 6:
88
+ if (tag !== 50) {
89
+ break;
90
+ }
91
+ message.type = { $case: "point", point: PBLightSource_Point.decode(reader, reader.uint32()) };
92
+ continue;
93
+ case 7:
94
+ if (tag !== 58) {
95
+ break;
96
+ }
97
+ message.type = { $case: "spot", spot: PBLightSource_Spot.decode(reader, reader.uint32()) };
98
+ continue;
99
+ }
100
+ if ((tag & 7) === 4 || tag === 0) {
101
+ break;
102
+ }
103
+ reader.skipType(tag & 7);
104
+ }
105
+ return message;
106
+ }
107
+ PBLightSource.decode = decode;
108
+ })(PBLightSource = exports.PBLightSource || (exports.PBLightSource = {}));
109
+ function createBasePBLightSource_Point() {
110
+ return { shadow: undefined };
111
+ }
112
+ /**
113
+ * @public
114
+ */
115
+ var PBLightSource_Point;
116
+ (function (PBLightSource_Point) {
117
+ function encode(message, writer = minimal_1.default.Writer.create()) {
118
+ if (message.shadow !== undefined) {
119
+ writer.uint32(40).int32(message.shadow);
120
+ }
121
+ return writer;
122
+ }
123
+ PBLightSource_Point.encode = encode;
124
+ function decode(input, length) {
125
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
126
+ let end = length === undefined ? reader.len : reader.pos + length;
127
+ const message = createBasePBLightSource_Point();
128
+ while (reader.pos < end) {
129
+ const tag = reader.uint32();
130
+ switch (tag >>> 3) {
131
+ case 5:
132
+ if (tag !== 40) {
133
+ break;
134
+ }
135
+ message.shadow = reader.int32();
136
+ continue;
137
+ }
138
+ if ((tag & 7) === 4 || tag === 0) {
139
+ break;
140
+ }
141
+ reader.skipType(tag & 7);
142
+ }
143
+ return message;
144
+ }
145
+ PBLightSource_Point.decode = decode;
146
+ })(PBLightSource_Point = exports.PBLightSource_Point || (exports.PBLightSource_Point = {}));
147
+ function createBasePBLightSource_Spot() {
148
+ return { innerAngle: undefined, outerAngle: undefined, shadow: undefined, shadowMaskTexture: undefined };
149
+ }
150
+ /**
151
+ * @public
152
+ */
153
+ var PBLightSource_Spot;
154
+ (function (PBLightSource_Spot) {
155
+ function encode(message, writer = minimal_1.default.Writer.create()) {
156
+ if (message.innerAngle !== undefined) {
157
+ writer.uint32(13).float(message.innerAngle);
158
+ }
159
+ if (message.outerAngle !== undefined) {
160
+ writer.uint32(21).float(message.outerAngle);
161
+ }
162
+ if (message.shadow !== undefined) {
163
+ writer.uint32(40).int32(message.shadow);
164
+ }
165
+ if (message.shadowMaskTexture !== undefined) {
166
+ texture_gen_1.TextureUnion.encode(message.shadowMaskTexture, writer.uint32(66).fork()).ldelim();
167
+ }
168
+ return writer;
169
+ }
170
+ PBLightSource_Spot.encode = encode;
171
+ function decode(input, length) {
172
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
173
+ let end = length === undefined ? reader.len : reader.pos + length;
174
+ const message = createBasePBLightSource_Spot();
175
+ while (reader.pos < end) {
176
+ const tag = reader.uint32();
177
+ switch (tag >>> 3) {
178
+ case 1:
179
+ if (tag !== 13) {
180
+ break;
181
+ }
182
+ message.innerAngle = reader.float();
183
+ continue;
184
+ case 2:
185
+ if (tag !== 21) {
186
+ break;
187
+ }
188
+ message.outerAngle = reader.float();
189
+ continue;
190
+ case 5:
191
+ if (tag !== 40) {
192
+ break;
193
+ }
194
+ message.shadow = reader.int32();
195
+ continue;
196
+ case 8:
197
+ if (tag !== 66) {
198
+ break;
199
+ }
200
+ message.shadowMaskTexture = texture_gen_1.TextureUnion.decode(reader, reader.uint32());
201
+ continue;
202
+ }
203
+ if ((tag & 7) === 4 || tag === 0) {
204
+ break;
205
+ }
206
+ reader.skipType(tag & 7);
207
+ }
208
+ return message;
209
+ }
210
+ PBLightSource_Spot.decode = decode;
211
+ })(PBLightSource_Spot = exports.PBLightSource_Spot || (exports.PBLightSource_Spot = {}));
@@ -16,6 +16,7 @@ import { AudioStreamComponentDefinitionExtended } from './extended/AudioStream';
16
16
  import { MediaState } from './generated/pb/decentraland/sdk/components/common/media_state.gen';
17
17
  import { VirtualCameraComponentDefinitionExtended } from './extended/VirtualCamera';
18
18
  import { InputModifierComponentDefinitionExtended } from './extended/InputModifier';
19
+ import { LightSourceComponentDefinitionExtended } from './extended/LightSource';
19
20
  export * from './generated/index.gen';
20
21
  export type { GrowOnlyValueSetComponentDefinition, LastWriteWinElementSetComponentDefinition, LwwComponentGetter, GSetComponentGetter };
21
22
  export declare const Transform: LwwComponentGetter<TransformComponentExtended>;
@@ -28,6 +29,7 @@ export declare const MeshCollider: LwwComponentGetter<MeshColliderComponentDefin
28
29
  export declare const Tween: LwwComponentGetter<TweenComponentDefinitionExtended>;
29
30
  export declare const VirtualCamera: LwwComponentGetter<VirtualCameraComponentDefinitionExtended>;
30
31
  export declare const InputModifier: LwwComponentGetter<InputModifierComponentDefinitionExtended>;
32
+ export declare const LightSource: LwwComponentGetter<LightSourceComponentDefinitionExtended>;
31
33
  /**
32
34
  * @alpha
33
35
  */
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.MediaState = exports.NetworkParent = exports.NetworkEntity = exports.SyncComponents = exports.Name = exports.InputModifier = exports.VirtualCamera = exports.Tween = exports.MeshCollider = exports.MeshRenderer = exports.AudioStream = exports.AudioSource = exports.Animator = exports.Material = exports.Transform = void 0;
20
+ exports.MediaState = exports.NetworkParent = exports.NetworkEntity = exports.SyncComponents = exports.Name = exports.LightSource = exports.InputModifier = exports.VirtualCamera = exports.Tween = exports.MeshCollider = exports.MeshRenderer = exports.AudioStream = exports.AudioSource = exports.Animator = exports.Material = exports.Transform = void 0;
21
21
  const Animator_1 = require("./extended/Animator");
22
22
  const AudioSource_1 = require("./extended/AudioSource");
23
23
  const Material_1 = require("./extended/Material");
@@ -34,6 +34,7 @@ const media_state_gen_1 = require("./generated/pb/decentraland/sdk/components/co
34
34
  Object.defineProperty(exports, "MediaState", { enumerable: true, get: function () { return media_state_gen_1.MediaState; } });
35
35
  const VirtualCamera_1 = require("./extended/VirtualCamera");
36
36
  const InputModifier_1 = require("./extended/InputModifier");
37
+ const LightSource_1 = require("./extended/LightSource");
37
38
  __exportStar(require("./generated/index.gen"), exports);
38
39
  /* @__PURE__ */
39
40
  const Transform = (engine) => (0, Transform_1.defineTransformComponent)(engine);
@@ -65,6 +66,9 @@ exports.VirtualCamera = VirtualCamera;
65
66
  /* @__PURE__*/
66
67
  const InputModifier = (engine) => (0, InputModifier_1.defineInputModifierComponent)(engine);
67
68
  exports.InputModifier = InputModifier;
69
+ /* @__PURE__*/
70
+ const LightSource = (engine) => (0, LightSource_1.defineLightSourceComponent)(engine);
71
+ exports.LightSource = LightSource;
68
72
  /**
69
73
  * @alpha
70
74
  */
@@ -12,3 +12,4 @@ export type { ISyncComponents, ISyncComponentsType } from './manual/SyncComponen
12
12
  export type { INetowrkEntity, INetowrkEntityType } from './manual/NetworkEntity';
13
13
  export type { INetowrkParent, INetowrkParentType } from './manual/NetworkParent';
14
14
  export type { InputModifierHelper, InputModifierComponentDefinitionExtended } from './extended/InputModifier';
15
+ export type { LightSourceHelper, LightSourceComponentDefinitionExtended } from './extended/LightSource';
@@ -11,7 +11,7 @@ export * from './systems/async-task';
11
11
  export * from './systems/tween';
12
12
  export * from './engine/entity';
13
13
  export * from './components/types';
14
- import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended } from './components/types';
14
+ import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended, LightSourceComponentDefinitionExtended } from './components/types';
15
15
  import { NameComponent } from './components/manual/Name';
16
16
  export declare const Transform: TransformComponentExtended;
17
17
  export declare const Animator: AnimatorComponentDefinitionExtended;
@@ -24,6 +24,7 @@ export declare const Name: NameComponent;
24
24
  export declare const Tween: TweenComponentDefinitionExtended;
25
25
  export declare const VirtualCamera: VirtualCameraComponentDefinitionExtended;
26
26
  export declare const InputModifier: InputModifierComponentDefinitionExtended;
27
+ export declare const LightSource: LightSourceComponentDefinitionExtended;
27
28
  /**
28
29
  * @alpha
29
30
  * This is going to be used for sync components through a server.
package/dist-cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.NetworkParent = exports.NetworkEntity = exports.SyncComponents = exports.InputModifier = exports.VirtualCamera = exports.Tween = exports.Name = exports.MeshCollider = exports.MeshRenderer = exports.Material = exports.AudioStream = exports.AudioSource = exports.Animator = exports.Transform = exports.components = exports.cyclicParentingChecker = void 0;
29
+ exports.NetworkParent = exports.NetworkEntity = exports.SyncComponents = exports.LightSource = exports.InputModifier = exports.VirtualCamera = exports.Tween = exports.Name = exports.MeshCollider = exports.MeshRenderer = exports.Material = exports.AudioStream = exports.AudioSource = exports.Animator = exports.Transform = exports.components = exports.cyclicParentingChecker = void 0;
30
30
  // The order of the following imports matters. Please do not auto-sort
31
31
  __exportStar(require("./engine"), exports);
32
32
  __exportStar(require("./schemas"), exports);
@@ -58,6 +58,7 @@ exports.Name = components.Name(initialization_1.engine);
58
58
  exports.Tween = components.Tween(initialization_1.engine);
59
59
  exports.VirtualCamera = components.VirtualCamera(initialization_1.engine);
60
60
  exports.InputModifier = components.InputModifier(initialization_1.engine);
61
+ exports.LightSource = components.LightSource(initialization_1.engine);
61
62
  /**
62
63
  * @alpha
63
64
  * This is going to be used for sync components through a server.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.7.6",
4
+ "version": "7.7.7-13655406288.commit-7b2a671",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -33,5 +33,5 @@
33
33
  },
34
34
  "types": "./dist/index.d.ts",
35
35
  "typings": "./dist/index.d.ts",
36
- "commit": "0f0d261556e5c6d495156f6a6e03233997a07a5e"
36
+ "commit": "7b2a6716919850a45b2f84abc9d05a1500ad6af3"
37
37
  }