@dcl/ecs 7.7.0 → 7.7.1-12789404522.commit-01f4702

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
- import { PBTween, Move, Rotate, Scale } from '../generated/index.gen';
2
+ import { PBTween, Move, Rotate, Scale, TextureMove } from '../generated/index.gen';
3
3
  /**
4
4
  * @public
5
5
  */
@@ -16,6 +16,10 @@ export interface TweenHelper {
16
16
  * @returns a move mode tween
17
17
  */
18
18
  Scale: (scale: Scale) => PBTween['mode'];
19
+ /**
20
+ * @returns a texture move mode tween
21
+ */
22
+ TextureMove: (textureMove: TextureMove) => PBTween['mode'];
19
23
  }
20
24
  /**
21
25
  * @public
@@ -17,6 +17,12 @@ const TweenHelper = {
17
17
  $case: 'scale',
18
18
  scale
19
19
  };
20
+ },
21
+ TextureMove(textureMove) {
22
+ return {
23
+ $case: 'textureMove',
24
+ textureMove
25
+ };
20
26
  }
21
27
  };
22
28
  export function defineTweenComponent(engine) {
@@ -25,12 +25,9 @@ export interface Texture {
25
25
  wrapMode?: TextureWrapMode | undefined;
26
26
  /** default = FilterMode.Bilinear */
27
27
  filterMode?: TextureFilterMode | undefined;
28
- /**
29
- * Final uv = offset + (input_uv * tiling)
30
- * Offset for texture positioning.
31
- */
28
+ /** Final uv = offset + (input_uv * tiling) */
32
29
  offset?: Vector2 | undefined;
33
- /** Tiling multiplier for texture repetition. */
30
+ /** default = Vector2.One; Tiling multiplier for texture repetition, only works for the texture property in PbrMaterial or UnlitMaterial. */
34
31
  tiling?: Vector2 | undefined;
35
32
  }
36
33
  /**
@@ -35,7 +35,7 @@ export interface PBMaterial_UnlitMaterial {
35
35
  castShadows?: boolean | undefined;
36
36
  /** default = white; */
37
37
  diffuseColor?: Color4 | undefined;
38
- /** default = null */
38
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
39
39
  alphaTexture?: TextureUnion | undefined;
40
40
  }
41
41
  /**
@@ -50,9 +50,9 @@ export interface PBMaterial_PbrMaterial {
50
50
  castShadows?: boolean | undefined;
51
51
  /** @deprecated Alpha textures are no longer supported on PBRMaterial and UnlitMaterial.alphaTexture should be used instead. */
52
52
  alphaTexture?: TextureUnion | undefined;
53
- /** default = null */
53
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
54
54
  emissiveTexture?: TextureUnion | undefined;
55
- /** default = null */
55
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
56
56
  bumpTexture?: TextureUnion | undefined;
57
57
  /** default = white; */
58
58
  albedoColor?: Color4 | undefined;
@@ -1,5 +1,13 @@
1
1
  import _m0 from "protobufjs/minimal";
2
- import { Quaternion, Vector3 } from "../../common/vectors.gen";
2
+ import { Quaternion, Vector2, Vector3 } from "../../common/vectors.gen";
3
+ /**
4
+ * @public
5
+ */
6
+ export declare const enum TextureMovementType {
7
+ /** TMT_OFFSET - default = TextureMovementType.TMT_OFFSET */
8
+ TMT_OFFSET = 0,
9
+ TMT_TILING = 1
10
+ }
3
11
  /**
4
12
  * Implementation guidelines for these easing functions can be found
5
13
  * at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
@@ -57,6 +65,9 @@ export interface PBTween {
57
65
  } | {
58
66
  $case: "scale";
59
67
  scale: Scale;
68
+ } | {
69
+ $case: "textureMove";
70
+ textureMove: TextureMove;
60
71
  } | undefined;
61
72
  /** default true (pause or running) */
62
73
  playing?: boolean | undefined;
@@ -85,6 +96,19 @@ export interface Scale {
85
96
  start: Vector3 | undefined;
86
97
  end: Vector3 | undefined;
87
98
  }
99
+ /**
100
+ * This tween mode allows to move the texture of a PbrMaterial or UnlitMaterial.
101
+ * You can also specify the movement type (offset or tiling)
102
+ */
103
+ /**
104
+ * @public
105
+ */
106
+ export interface TextureMove {
107
+ start: Vector2 | undefined;
108
+ end: Vector2 | undefined;
109
+ /** default = TextureMovementType.TMT_OFFSET */
110
+ movementType?: TextureMovementType | undefined;
111
+ }
88
112
  /**
89
113
  * @public
90
114
  */
@@ -113,3 +137,10 @@ export declare namespace Scale {
113
137
  function encode(message: Scale, writer?: _m0.Writer): _m0.Writer;
114
138
  function decode(input: _m0.Reader | Uint8Array, length?: number): Scale;
115
139
  }
140
+ /**
141
+ * @public
142
+ */
143
+ export declare namespace TextureMove {
144
+ function encode(message: TextureMove, writer?: _m0.Writer): _m0.Writer;
145
+ function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMove;
146
+ }
@@ -1,7 +1,16 @@
1
1
  /* eslint-disable */
2
2
  import _m0 from "protobufjs/minimal";
3
- import { Quaternion, Vector3 } from "../../common/vectors.gen";
3
+ import { Quaternion, Vector2, Vector3 } from "../../common/vectors.gen";
4
4
  const protobufPackageSarasa = "decentraland.sdk.components";
5
+ /**
6
+ * @public
7
+ */
8
+ export var TextureMovementType;
9
+ (function (TextureMovementType) {
10
+ /** TMT_OFFSET - default = TextureMovementType.TMT_OFFSET */
11
+ TextureMovementType[TextureMovementType["TMT_OFFSET"] = 0] = "TMT_OFFSET";
12
+ TextureMovementType[TextureMovementType["TMT_TILING"] = 1] = "TMT_TILING";
13
+ })(TextureMovementType || (TextureMovementType = {}));
5
14
  /**
6
15
  * Implementation guidelines for these easing functions can be found
7
16
  * at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
@@ -69,6 +78,9 @@ export var PBTween;
69
78
  case "scale":
70
79
  Scale.encode(message.mode.scale, writer.uint32(42).fork()).ldelim();
71
80
  break;
81
+ case "textureMove":
82
+ TextureMove.encode(message.mode.textureMove, writer.uint32(66).fork()).ldelim();
83
+ break;
72
84
  }
73
85
  if (message.playing !== undefined) {
74
86
  writer.uint32(48).bool(message.playing);
@@ -116,6 +128,12 @@ export var PBTween;
116
128
  }
117
129
  message.mode = { $case: "scale", scale: Scale.decode(reader, reader.uint32()) };
118
130
  continue;
131
+ case 8:
132
+ if (tag !== 66) {
133
+ break;
134
+ }
135
+ message.mode = { $case: "textureMove", textureMove: TextureMove.decode(reader, reader.uint32()) };
136
+ continue;
119
137
  case 6:
120
138
  if (tag !== 48) {
121
139
  break;
@@ -288,3 +306,59 @@ export var Scale;
288
306
  }
289
307
  Scale.decode = decode;
290
308
  })(Scale || (Scale = {}));
309
+ function createBaseTextureMove() {
310
+ return { start: undefined, end: undefined, movementType: undefined };
311
+ }
312
+ /**
313
+ * @public
314
+ */
315
+ export var TextureMove;
316
+ (function (TextureMove) {
317
+ function encode(message, writer = _m0.Writer.create()) {
318
+ if (message.start !== undefined) {
319
+ Vector2.encode(message.start, writer.uint32(10).fork()).ldelim();
320
+ }
321
+ if (message.end !== undefined) {
322
+ Vector2.encode(message.end, writer.uint32(18).fork()).ldelim();
323
+ }
324
+ if (message.movementType !== undefined) {
325
+ writer.uint32(24).int32(message.movementType);
326
+ }
327
+ return writer;
328
+ }
329
+ TextureMove.encode = encode;
330
+ function decode(input, length) {
331
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
332
+ let end = length === undefined ? reader.len : reader.pos + length;
333
+ const message = createBaseTextureMove();
334
+ while (reader.pos < end) {
335
+ const tag = reader.uint32();
336
+ switch (tag >>> 3) {
337
+ case 1:
338
+ if (tag !== 10) {
339
+ break;
340
+ }
341
+ message.start = Vector2.decode(reader, reader.uint32());
342
+ continue;
343
+ case 2:
344
+ if (tag !== 18) {
345
+ break;
346
+ }
347
+ message.end = Vector2.decode(reader, reader.uint32());
348
+ continue;
349
+ case 3:
350
+ if (tag !== 24) {
351
+ break;
352
+ }
353
+ message.movementType = reader.int32();
354
+ continue;
355
+ }
356
+ if ((tag & 7) === 4 || tag === 0) {
357
+ break;
358
+ }
359
+ reader.skipType(tag & 7);
360
+ }
361
+ return message;
362
+ }
363
+ TextureMove.decode = decode;
364
+ })(TextureMove || (TextureMove = {}));
@@ -113,6 +113,12 @@ export function createTweenSystem(engine) {
113
113
  if (tween.mode?.$case === 'scale' && tween.mode.scale) {
114
114
  return { ...tween, mode: { ...tween.mode, scale: { start: tween.mode.scale.end, end: tween.mode.scale.start } } };
115
115
  }
116
+ if (tween.mode?.$case === 'textureMove' && tween.mode.textureMove) {
117
+ return {
118
+ ...tween,
119
+ mode: { ...tween.mode, textureMove: { start: tween.mode.textureMove.end, end: tween.mode.textureMove.start } }
120
+ };
121
+ }
116
122
  /* istanbul ignore next */
117
123
  throw new Error('Invalid tween');
118
124
  }
@@ -1,5 +1,5 @@
1
1
  import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
- import { PBTween, Move, Rotate, Scale } from '../generated/index.gen';
2
+ import { PBTween, Move, Rotate, Scale, TextureMove } from '../generated/index.gen';
3
3
  /**
4
4
  * @public
5
5
  */
@@ -16,6 +16,10 @@ export interface TweenHelper {
16
16
  * @returns a move mode tween
17
17
  */
18
18
  Scale: (scale: Scale) => PBTween['mode'];
19
+ /**
20
+ * @returns a texture move mode tween
21
+ */
22
+ TextureMove: (textureMove: TextureMove) => PBTween['mode'];
19
23
  }
20
24
  /**
21
25
  * @public
@@ -20,6 +20,12 @@ const TweenHelper = {
20
20
  $case: 'scale',
21
21
  scale
22
22
  };
23
+ },
24
+ TextureMove(textureMove) {
25
+ return {
26
+ $case: 'textureMove',
27
+ textureMove
28
+ };
23
29
  }
24
30
  };
25
31
  function defineTweenComponent(engine) {
@@ -25,12 +25,9 @@ export interface Texture {
25
25
  wrapMode?: TextureWrapMode | undefined;
26
26
  /** default = FilterMode.Bilinear */
27
27
  filterMode?: TextureFilterMode | undefined;
28
- /**
29
- * Final uv = offset + (input_uv * tiling)
30
- * Offset for texture positioning.
31
- */
28
+ /** Final uv = offset + (input_uv * tiling) */
32
29
  offset?: Vector2 | undefined;
33
- /** Tiling multiplier for texture repetition. */
30
+ /** default = Vector2.One; Tiling multiplier for texture repetition, only works for the texture property in PbrMaterial or UnlitMaterial. */
34
31
  tiling?: Vector2 | undefined;
35
32
  }
36
33
  /**
@@ -35,7 +35,7 @@ export interface PBMaterial_UnlitMaterial {
35
35
  castShadows?: boolean | undefined;
36
36
  /** default = white; */
37
37
  diffuseColor?: Color4 | undefined;
38
- /** default = null */
38
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
39
39
  alphaTexture?: TextureUnion | undefined;
40
40
  }
41
41
  /**
@@ -50,9 +50,9 @@ export interface PBMaterial_PbrMaterial {
50
50
  castShadows?: boolean | undefined;
51
51
  /** @deprecated Alpha textures are no longer supported on PBRMaterial and UnlitMaterial.alphaTexture should be used instead. */
52
52
  alphaTexture?: TextureUnion | undefined;
53
- /** default = null */
53
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
54
54
  emissiveTexture?: TextureUnion | undefined;
55
- /** default = null */
55
+ /** default = null. Note that tilling and offset properties are ignored for this texture. */
56
56
  bumpTexture?: TextureUnion | undefined;
57
57
  /** default = white; */
58
58
  albedoColor?: Color4 | undefined;
@@ -1,5 +1,13 @@
1
1
  import _m0 from "protobufjs/minimal";
2
- import { Quaternion, Vector3 } from "../../common/vectors.gen";
2
+ import { Quaternion, Vector2, Vector3 } from "../../common/vectors.gen";
3
+ /**
4
+ * @public
5
+ */
6
+ export declare const enum TextureMovementType {
7
+ /** TMT_OFFSET - default = TextureMovementType.TMT_OFFSET */
8
+ TMT_OFFSET = 0,
9
+ TMT_TILING = 1
10
+ }
3
11
  /**
4
12
  * Implementation guidelines for these easing functions can be found
5
13
  * at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
@@ -57,6 +65,9 @@ export interface PBTween {
57
65
  } | {
58
66
  $case: "scale";
59
67
  scale: Scale;
68
+ } | {
69
+ $case: "textureMove";
70
+ textureMove: TextureMove;
60
71
  } | undefined;
61
72
  /** default true (pause or running) */
62
73
  playing?: boolean | undefined;
@@ -85,6 +96,19 @@ export interface Scale {
85
96
  start: Vector3 | undefined;
86
97
  end: Vector3 | undefined;
87
98
  }
99
+ /**
100
+ * This tween mode allows to move the texture of a PbrMaterial or UnlitMaterial.
101
+ * You can also specify the movement type (offset or tiling)
102
+ */
103
+ /**
104
+ * @public
105
+ */
106
+ export interface TextureMove {
107
+ start: Vector2 | undefined;
108
+ end: Vector2 | undefined;
109
+ /** default = TextureMovementType.TMT_OFFSET */
110
+ movementType?: TextureMovementType | undefined;
111
+ }
88
112
  /**
89
113
  * @public
90
114
  */
@@ -113,3 +137,10 @@ export declare namespace Scale {
113
137
  function encode(message: Scale, writer?: _m0.Writer): _m0.Writer;
114
138
  function decode(input: _m0.Reader | Uint8Array, length?: number): Scale;
115
139
  }
140
+ /**
141
+ * @public
142
+ */
143
+ export declare namespace TextureMove {
144
+ function encode(message: TextureMove, writer?: _m0.Writer): _m0.Writer;
145
+ function decode(input: _m0.Reader | Uint8Array, length?: number): TextureMove;
146
+ }
@@ -3,11 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Scale = exports.Rotate = exports.Move = exports.PBTween = exports.EasingFunction = void 0;
6
+ exports.TextureMove = exports.Scale = exports.Rotate = exports.Move = exports.PBTween = exports.EasingFunction = exports.TextureMovementType = void 0;
7
7
  /* eslint-disable */
8
8
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
9
9
  const vectors_gen_1 = require("../../common/vectors.gen");
10
10
  const protobufPackageSarasa = "decentraland.sdk.components";
11
+ /**
12
+ * @public
13
+ */
14
+ var TextureMovementType;
15
+ (function (TextureMovementType) {
16
+ /** TMT_OFFSET - default = TextureMovementType.TMT_OFFSET */
17
+ TextureMovementType[TextureMovementType["TMT_OFFSET"] = 0] = "TMT_OFFSET";
18
+ TextureMovementType[TextureMovementType["TMT_TILING"] = 1] = "TMT_TILING";
19
+ })(TextureMovementType = exports.TextureMovementType || (exports.TextureMovementType = {}));
11
20
  /**
12
21
  * Implementation guidelines for these easing functions can be found
13
22
  * at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
@@ -75,6 +84,9 @@ var PBTween;
75
84
  case "scale":
76
85
  Scale.encode(message.mode.scale, writer.uint32(42).fork()).ldelim();
77
86
  break;
87
+ case "textureMove":
88
+ TextureMove.encode(message.mode.textureMove, writer.uint32(66).fork()).ldelim();
89
+ break;
78
90
  }
79
91
  if (message.playing !== undefined) {
80
92
  writer.uint32(48).bool(message.playing);
@@ -122,6 +134,12 @@ var PBTween;
122
134
  }
123
135
  message.mode = { $case: "scale", scale: Scale.decode(reader, reader.uint32()) };
124
136
  continue;
137
+ case 8:
138
+ if (tag !== 66) {
139
+ break;
140
+ }
141
+ message.mode = { $case: "textureMove", textureMove: TextureMove.decode(reader, reader.uint32()) };
142
+ continue;
125
143
  case 6:
126
144
  if (tag !== 48) {
127
145
  break;
@@ -294,3 +312,59 @@ var Scale;
294
312
  }
295
313
  Scale.decode = decode;
296
314
  })(Scale = exports.Scale || (exports.Scale = {}));
315
+ function createBaseTextureMove() {
316
+ return { start: undefined, end: undefined, movementType: undefined };
317
+ }
318
+ /**
319
+ * @public
320
+ */
321
+ var TextureMove;
322
+ (function (TextureMove) {
323
+ function encode(message, writer = minimal_1.default.Writer.create()) {
324
+ if (message.start !== undefined) {
325
+ vectors_gen_1.Vector2.encode(message.start, writer.uint32(10).fork()).ldelim();
326
+ }
327
+ if (message.end !== undefined) {
328
+ vectors_gen_1.Vector2.encode(message.end, writer.uint32(18).fork()).ldelim();
329
+ }
330
+ if (message.movementType !== undefined) {
331
+ writer.uint32(24).int32(message.movementType);
332
+ }
333
+ return writer;
334
+ }
335
+ TextureMove.encode = encode;
336
+ function decode(input, length) {
337
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
338
+ let end = length === undefined ? reader.len : reader.pos + length;
339
+ const message = createBaseTextureMove();
340
+ while (reader.pos < end) {
341
+ const tag = reader.uint32();
342
+ switch (tag >>> 3) {
343
+ case 1:
344
+ if (tag !== 10) {
345
+ break;
346
+ }
347
+ message.start = vectors_gen_1.Vector2.decode(reader, reader.uint32());
348
+ continue;
349
+ case 2:
350
+ if (tag !== 18) {
351
+ break;
352
+ }
353
+ message.end = vectors_gen_1.Vector2.decode(reader, reader.uint32());
354
+ continue;
355
+ case 3:
356
+ if (tag !== 24) {
357
+ break;
358
+ }
359
+ message.movementType = reader.int32();
360
+ continue;
361
+ }
362
+ if ((tag & 7) === 4 || tag === 0) {
363
+ break;
364
+ }
365
+ reader.skipType(tag & 7);
366
+ }
367
+ return message;
368
+ }
369
+ TextureMove.decode = decode;
370
+ })(TextureMove = exports.TextureMove || (exports.TextureMove = {}));
@@ -139,6 +139,12 @@ function createTweenSystem(engine) {
139
139
  if (tween.mode?.$case === 'scale' && tween.mode.scale) {
140
140
  return { ...tween, mode: { ...tween.mode, scale: { start: tween.mode.scale.end, end: tween.mode.scale.start } } };
141
141
  }
142
+ if (tween.mode?.$case === 'textureMove' && tween.mode.textureMove) {
143
+ return {
144
+ ...tween,
145
+ mode: { ...tween.mode, textureMove: { start: tween.mode.textureMove.end, end: tween.mode.textureMove.start } }
146
+ };
147
+ }
142
148
  /* istanbul ignore next */
143
149
  throw new Error('Invalid tween');
144
150
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.7.0",
4
+ "version": "7.7.1-12789404522.commit-01f4702",
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": "392992dd51fe8a48adf7381c5a6b267df0dfda6d"
36
+ "commit": "01f47021cb864d6d8e8abd32f2d5bf8dc9856e91"
37
37
  }