@dcl/sdk 7.0.0-3445274368.commit-063bc43 → 7.0.0-3469489430.commit-9c7979a

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.
@@ -17,26 +17,40 @@ enum MaterialTransparencyMode {
17
17
  }
18
18
 
19
19
  message PBMaterial {
20
- optional decentraland.common.TextureUnion texture = 1; // default = null
20
+ message UnlitMaterial {
21
+ optional decentraland.common.TextureUnion texture = 1; // default = null
22
+ optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
23
+ optional bool cast_shadows = 3; // default = true
24
+ }
25
+
26
+ message PbrMaterial {
27
+ optional decentraland.common.TextureUnion texture = 1; // default = null
28
+
29
+ optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
30
+ optional bool cast_shadows = 3; // default = true
31
+
32
+ optional decentraland.common.TextureUnion alpha_texture = 4; // default = null
33
+ optional decentraland.common.TextureUnion emissive_texture = 5; // default = null
34
+ optional decentraland.common.TextureUnion bump_texture = 6; // default = null
35
+
36
+ optional decentraland.common.Color3 albedo_color = 7; // default = white;
37
+ optional decentraland.common.Color3 emissive_color = 8; // default = black;
38
+ optional decentraland.common.Color3 reflectivity_color = 9; // default = white;
39
+
40
+ optional MaterialTransparencyMode transparency_mode = 10; // default = TransparencyMode.Auto
41
+
42
+ optional float metallic = 11; // default = 0.5
43
+ optional float roughness = 12; // default = 0.5
44
+ optional float glossiness = 13; // default = 1
45
+
46
+ optional float specular_intensity = 14; // default = 1
47
+ optional float emissive_intensity = 15; // default = 2
48
+ optional float direct_intensity = 16; // default = 1
49
+ }
50
+
51
+ oneof material {
52
+ UnlitMaterial unlit = 1;
53
+ PbrMaterial pbr = 2;
54
+ }
21
55
 
22
- optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
23
- optional bool cast_shadows = 3; // default = true
24
-
25
- optional decentraland.common.TextureUnion alpha_texture = 4; // default = null
26
- optional decentraland.common.TextureUnion emissive_texture = 5; // default = null
27
- optional decentraland.common.TextureUnion bump_texture = 6; // default = null
28
-
29
- optional decentraland.common.Color3 albedo_color = 7; // default = white;
30
- optional decentraland.common.Color3 emissive_color = 8; // default = black;
31
- optional decentraland.common.Color3 reflectivity_color = 9; // default = white;
32
-
33
- optional MaterialTransparencyMode transparency_mode = 10; // default = TransparencyMode.Auto
34
-
35
- optional float metallic = 11; // default = 0.5
36
- optional float roughness = 12; // default = 0.5
37
- optional float glossiness = 13; // default = 1
38
-
39
- optional float specular_intensity = 14; // default = 1
40
- optional float emissive_intensity = 15; // default = 2
41
- optional float direct_intensity = 16; // default = 1
42
56
  }
@@ -2,10 +2,15 @@ function createPlaneTexture(x: number, y: number, z: number): Entity {
2
2
  const meshEntity = engine.addEntity()
3
3
 
4
4
  Material.create(meshEntity, {
5
- texture: {
6
- tex: {
7
- $case: 'texture',
8
- texture: { src: 'models/polaroid2.png' }
5
+ material: {
6
+ $case: 'pbr',
7
+ pbr: {
8
+ texture: {
9
+ tex: {
10
+ $case: 'texture',
11
+ texture: { src: 'models/polaroid2.png' }
12
+ }
13
+ }
9
14
  }
10
15
  }
11
16
  })
@@ -6,27 +6,42 @@ function createSphere(x: number, y: number, z: number): Entity {
6
6
  }
7
7
 
8
8
  Material.create(createSphere(15, 1, 15), {
9
- albedoColor: { r: 0, g: 0, b: 1 },
10
- reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
11
- metallic: 0.8,
12
- roughness: 0.1
9
+ material: {
10
+ $case: 'pbr',
11
+ pbr: {
12
+ albedoColor: { r: 0, g: 0, b: 1 },
13
+ reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
14
+ metallic: 0.8,
15
+ roughness: 0.1
16
+ }
17
+ }
13
18
  })
14
19
 
15
20
  Material.create(createSphere(13, 1, 15), {
16
- albedoColor: { r: 1, g: 1, b: 0 },
17
- reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
18
- metallic: 0.1,
19
- roughness: 0.8,
21
+ material: {
22
+ $case: 'pbr',
23
+ pbr: {
24
+ albedoColor: { r: 1, g: 1, b: 0 },
25
+ reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
26
+ metallic: 0.1,
27
+ roughness: 0.8,
20
28
 
21
- alphaTest: 0.2,
22
- transparencyMode: MaterialTransparencyMode.MTM_ALPHA_TEST
29
+ alphaTest: 0.2,
30
+ transparencyMode: MaterialTransparencyMode.MTM_ALPHA_TEST
31
+ }
32
+ }
23
33
  })
24
34
 
25
35
  Material.create(createSphere(11, 1, 15), {
26
- albedoColor: { r: 0, g: 0, b: 1 },
27
- reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
28
- metallic: 0.1,
29
- roughness: 0.1
36
+ material: {
37
+ $case: 'pbr',
38
+ pbr: {
39
+ albedoColor: { r: 0, g: 0, b: 1 },
40
+ reflectivityColor: { r: 0.5, g: 0.5, b: 0.5 },
41
+ metallic: 0.1,
42
+ roughness: 0.1
43
+ }
44
+ }
30
45
  })
31
46
 
32
47
  // add textures
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/sdk",
3
- "version": "7.0.0-3445274368.commit-063bc43",
3
+ "version": "7.0.0-3469489430.commit-9c7979a",
4
4
  "description": "",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -23,13 +23,13 @@
23
23
  "artifacts"
24
24
  ],
25
25
  "dependencies": {
26
- "@dcl/amd": "7.0.0-3445274368.commit-063bc43",
27
- "@dcl/build-ecs": "7.0.0-3445274368.commit-063bc43",
28
- "@dcl/js-runtime": "7.0.0-3445274368.commit-063bc43",
26
+ "@dcl/amd": "7.0.0-3469489430.commit-9c7979a",
27
+ "@dcl/build-ecs": "7.0.0-3469489430.commit-9c7979a",
28
+ "@dcl/js-runtime": "7.0.0-3469489430.commit-9c7979a",
29
29
  "@dcl/kernel": "^1.0.0-3339209749.commit-fa9e5d7",
30
30
  "@dcl/posix": "^1.0.4",
31
31
  "@dcl/unity-renderer": "^1.0.59980-20221027151836.commit-cc26142"
32
32
  },
33
33
  "minCliVersion": "3.12.3",
34
- "commit": "063bc43ca5e86c274fd66ce485e89becd12962d8"
34
+ "commit": "9c7979a6ebc1a914467f9eb81622189bf1f5ff1e"
35
35
  }
@@ -1,7 +1,50 @@
1
1
  /// <reference types="@dcl/posix" />
2
2
 
3
3
  /** @public */
4
- declare const Animator: ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
4
+ declare const Animator: AnimatorComponentDefinition;
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ declare interface AnimatorComponentDefinition extends ComponentDefinition {
10
+ /**
11
+ * @public
12
+ *
13
+ * Get a `mutable` version of animator clip
14
+ * @param entity - entity with Animator component
15
+ * @param name - the field `name` of the component
16
+ * @returns the clip or fails if it isn't found
17
+ */
18
+ getClip(entity: Entity, name: string): PBAnimationState;
19
+ /**
20
+ * @public
21
+ *
22
+ * Get a `mutable` version of animator clip
23
+ * @param entity - entity with Animator component
24
+ * @param name - the field `name` of the component
25
+ * @returns the clip or null if it isn't found
26
+ */
27
+ getClipOrNull(entity: Entity, name: string): PBAnimationState | null;
28
+ /**
29
+ * @public
30
+ *
31
+ * Set playing=true the animation `$name`
32
+ * @param entity - entity with Animator component
33
+ * @param name - animation name
34
+ * @param resetCursor - the animation starts at 0 or continues from the current cursor position
35
+ * @returns true in successful playing, false if it doesn't find the Animator or clip
36
+ */
37
+ playSingleAnimation(entity: Entity, name: string, resetCursor?: boolean): boolean;
38
+ /**
39
+ * @public
40
+ *
41
+ * Set playing=false all animations
42
+ * @param entity - entity with Animator component
43
+ * @param resetCursor - the animation stops at 0 or at the current cursor position
44
+ * @returns true in successful playing, false if it doesn't find the Animator
45
+ */
46
+ stopAllAnimations(entity: Entity, resetCursor?: boolean): boolean;
47
+ }
5
48
 
6
49
  /** @public */
7
50
  declare const AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
@@ -917,7 +960,7 @@ declare namespace Components {
917
960
  /** @public */
918
961
  const Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
919
962
  /** @public */
920
- const Animator: ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
963
+ const Animator: AnimatorComponentDefinition;
921
964
  /** @public */
922
965
  const AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
923
966
  /** @public */
@@ -1156,8 +1199,8 @@ declare type DeepReadonlyObject<T> = {
1156
1199
  declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1157
1200
 
1158
1201
  declare function defineSdkComponents(engine: PreEngine): {
1202
+ Animator: AnimatorComponentDefinition;
1159
1203
  Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
1160
- Animator: ComponentDefinition<ISchema<PBAnimator>, PBAnimator>;
1161
1204
  AudioSource: ComponentDefinition<ISchema<PBAudioSource>, PBAudioSource>;
1162
1205
  AudioStream: ComponentDefinition<ISchema<PBAudioStream>, PBAudioStream>;
1163
1206
  AvatarAttach: ComponentDefinition<ISchema<PBAvatarAttach>, PBAvatarAttach>;
@@ -2616,10 +2659,6 @@ declare interface PBAnimationState {
2616
2659
  shouldReset?: boolean | undefined;
2617
2660
  }
2618
2661
 
2619
- declare interface PBAnimator {
2620
- states: PBAnimationState[];
2621
- }
2622
-
2623
2662
  declare interface PBAudioSource {
2624
2663
  playing?: boolean | undefined;
2625
2664
  /** default=1.0f */
@@ -2700,6 +2739,16 @@ declare interface PBGltfContainer {
2700
2739
  }
2701
2740
 
2702
2741
  declare interface PBMaterial {
2742
+ material?: {
2743
+ $case: 'unlit';
2744
+ unlit: PBMaterial_UnlitMaterial;
2745
+ } | {
2746
+ $case: 'pbr';
2747
+ pbr: PBMaterial_PbrMaterial;
2748
+ };
2749
+ }
2750
+
2751
+ declare interface PBMaterial_PbrMaterial {
2703
2752
  /** default = null */
2704
2753
  texture?: TextureUnion | undefined;
2705
2754
  /** default = 0.5. range value: from 0 to 1 */
@@ -2734,6 +2783,15 @@ declare interface PBMaterial {
2734
2783
  directIntensity?: number | undefined;
2735
2784
  }
2736
2785
 
2786
+ declare interface PBMaterial_UnlitMaterial {
2787
+ /** default = null */
2788
+ texture?: TextureUnion | undefined;
2789
+ /** default = 0.5. range value: from 0 to 1 */
2790
+ alphaTest?: number | undefined;
2791
+ /** default = true */
2792
+ castShadows?: boolean | undefined;
2793
+ }
2794
+
2737
2795
  declare interface PBMeshCollider {
2738
2796
  /** default = ColliderLayer.Physics | ColliderLayer.Pointer */
2739
2797
  collisionMask?: number | undefined;
@@ -3665,6 +3723,7 @@ declare namespace Schemas {
3665
3723
  const Quaternion: ISchema<QuaternionType>;
3666
3724
  const Color3: ISchema<Color3Type>;
3667
3725
  const Color4: ISchema<Color4Type>;
3726
+ const Entity: ISchema<Entity>;
3668
3727
  const Enum: typeof IEnum;
3669
3728
  const Array: typeof IArray;
3670
3729
  const Map: typeof IMap;