Skip to content

Commit f738435

Browse files
authored
Merge branch 'protocol-squad' into pointer_position_and_drag
2 parents 203f87c + 591a12f commit f738435

19 files changed

+243
-9
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ all: buf-lint buf-build test
2424
install:
2525
npm i
2626
rm -rf proto/google || true
27-
cp -r node_modules/protobufjs/google proto/google
27+
cp -r node_modules/protobufjs/google proto/google
28+
29+
list-components-ids:
30+
@bash scripts/list-components-ids.sh
31+
32+
check-component-id:
33+
@bash scripts/check-component-id.sh $(ID)

proto/decentraland/common/texture.proto

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
syntax = "proto3";
22
package decentraland.common;
3+
import "decentraland/common/vectors.proto";
34

45
enum TextureWrapMode {
56
TWM_REPEAT = 0;
@@ -17,6 +18,10 @@ message Texture {
1718
string src = 1;
1819
optional TextureWrapMode wrap_mode = 2; // default = TextureWrapMode.Clamp
1920
optional TextureFilterMode filter_mode = 3; // default = FilterMode.Bilinear
21+
22+
// Final uv = offset + (input_uv * tiling)
23+
optional Vector2 offset = 4; // default = Vector2.Zero; Offset for texture positioning, only works for the texture property in PbrMaterial or UnlitMaterial.
24+
optional Vector2 tiling = 5; // default = Vector2.One; Tiling multiplier for texture repetition, only works for the texture property in PbrMaterial or UnlitMaterial.
2025
}
2126

2227
message AvatarTexture {
@@ -31,10 +36,17 @@ message VideoTexture {
3136
optional TextureFilterMode filter_mode = 3; // default = FilterMode.Bilinear
3237
}
3338

39+
message UiCanvasTexture {
40+
uint32 ui_canvas_entity = 1;
41+
optional TextureWrapMode wrap_mode = 2; // default = TextureWrapMode.Clamp
42+
optional TextureFilterMode filter_mode = 3; // default = FilterMode.Bilinear
43+
}
44+
3445
message TextureUnion {
3546
oneof tex {
3647
Texture texture = 1; // default = null
3748
AvatarTexture avatar_texture = 2; // default = null
3849
VideoTexture video_texture = 3; // default = null
50+
UiCanvasTexture ui_texture = 4;
3951
}
40-
}
52+
}

proto/decentraland/kernel/comms/rfc4/comms.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ message Packet {
1717
Movement movement = 8;
1818
PlayerEmote player_emote = 9;
1919
SceneEmote scene_emote = 10;
20+
MovementCompressed movement_compressed = 12;
2021
}
2122
uint32 protocol_version = 11;
2223
}
@@ -56,6 +57,13 @@ message Movement {
5657
bool is_falling = 14;
5758

5859
bool is_stunned = 15;
60+
61+
float rotation_y = 16;
62+
}
63+
64+
message MovementCompressed {
65+
int32 temporal_data = 1; // bit-compressed: timestamp + animations
66+
int64 movement_data = 2; // bit-compressed: position + velocity
5967
}
6068

6169
message PlayerEmote {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components.common;
3+
4+
// Defines the transition used towards the camera that contains the CameraTransition.
5+
// This structure may be updated in the future to specify from/to entities and to have easing functions.
6+
message CameraTransition {
7+
oneof transition_mode {
8+
float time = 1;
9+
float speed = 2; // meters per second; e.g. speed 1 -> 1 meter per second
10+
}
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
4+
import "decentraland/common/colors.proto";
5+
import "decentraland/common/vectors.proto";
6+
7+
import "decentraland/sdk/components/common/id.proto";
8+
option (common.ecs_component_id) = 1206;
9+
10+
// defines the global scene light settings. must be added to the scene root.
11+
// to control sunlight color, intensity, shadows etc, you can also add a PBLight to the scene root.
12+
message PBGlobalLight {
13+
// the direction the directional light shines in.
14+
// default depends on time of day and explorer implementation
15+
optional decentraland.common.Vector3 direction = 1;
16+
// ambient light color
17+
// default: White
18+
optional decentraland.common.Color3 ambient_color = 2;
19+
// ambient light intensity. the explorer default ambient brightness is multiplied by this non-physical quantity.
20+
// default 1
21+
optional float ambient_brightness = 3;
22+
}

proto/decentraland/sdk/components/gltf_node.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import "decentraland/sdk/components/common/id.proto";
55
option (common.ecs_component_id) = 1200;
66

77
// a GltfNode links a scene entity with a node from within a gltf, allowing the scene to inspect it or modify it.
8-
// This component must be added to a direct child of an entity with a PbGltfContainer component, or
8+
// This component must be added to a direct child of an entity with a PBGltfContainer component, or
99
// to a direct child of another entity with a GltfNode component, and the referenced gltf node must be a descendent of the gltf node
1010
// in the parent.
1111
// The name must match the path of one of the nodes within the Gltf. These are available on the GltfContainerLoadingState component.
1212
//
13-
// The renderer will attach a PbGltfNodeState to the entity describing the state. Once the state is `GNS_READY`,
13+
// The renderer will attach a PBGltfNodeState to the entity describing the state. Once the state is `GNS_READY`,
1414
// - the `Transform` will be updated to match the position of the node within the gltf (relative to the gltf root, or the parent node),
1515
// - a `MeshRenderer` with a GltfMesh mesh type will be added (if the gltf node has a mesh).
1616
// - a `MeshCollider` with a GltfMesh mesh type will be added (if the gltf node has a collider).
@@ -27,7 +27,7 @@ option (common.ecs_component_id) = 1200;
2727
// - `MeshCollider` can be added/modified/removed to create/modify/remove a collider on the node.
2828
// - `Material` can be added or modified to change the material properties. If the gltf node has a material, the original material will be
2929
// used as a base, and any gltf features (e.g. occlusion maps) from the gtlf spec that the renderer supports but that are not exposed in the
30-
// PbMaterial will be maintained.
30+
// PBMaterial will be maintained.
3131
//
3232
// The scene can add additional entities as children to the gltf node, but structural modifications of the gltf are not possible:
3333
// - changing the scene hierarchy will not change the gltf node hierarchy. Moving the entity out of the gltf will sever the link and
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
import "decentraland/sdk/components/common/id.proto";
4+
option (common.ecs_component_id) = 1078;
5+
6+
message PBInputModifier {
7+
// when a boolean = false (default) the message is ignored and doesn't consume bandwidth
8+
message StandardInput {
9+
optional bool disable_all = 1;
10+
optional bool disable_walk = 2;
11+
optional bool disable_jog = 3;
12+
optional bool disable_run = 4;
13+
optional bool disable_jump = 5;
14+
optional bool disable_emote = 6;
15+
}
16+
17+
oneof mode {
18+
StandardInput standard = 1;
19+
}
20+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
4+
import "decentraland/common/colors.proto";
5+
6+
import "decentraland/sdk/components/common/id.proto";
7+
option (common.ecs_component_id) = 1204;
8+
9+
// defines a light source.
10+
// the world has a default directional light (like sunlight) which can be overridden by adding the light component to the scene root.
11+
// a PBGlobalLight component can also be added to the root to control the directional light direction.
12+
// point lights (lightbulbs) or spotlights can be created by attaching the light component to non-root entities.
13+
message PBLight {
14+
// whether the light is on
15+
// default true
16+
optional bool enabled = 1;
17+
// light brightness in lux (lumens/m^2).
18+
//
19+
// for global directional light, this applies as a constant value at all surfaces and distances (though the effect on the surface still depends on incidence angle).
20+
// the default global light illuminance varies from 400 (sunrise/sunset) to 10,000 (midday).
21+
// for typical values, see https://en.wikipedia.org/wiki/Lux#Illuminance
22+
//
23+
// for point and spot lights, this is the lumens/m^2 at 1m distance from the light. to transform from raw lumens,
24+
// divide lumens by ~12 (4*pi).
25+
// e.g. a 100w household bulb with 1200 lumens would have an illuminance of ~100.
26+
// a lighthouse bulb with 200,000 lumens would have an illuminance of ~15,000 (ignoring beam reflections)
27+
//
28+
// default
29+
// for point/spotlights: 10,000
30+
// for global directional light: depends on explorer implementation. may vary on light direction, time of day, etc
31+
optional float illuminance = 2;
32+
// whether the light should cast shadows.
33+
// note: even when set to true the engine may not display shadows, or may only show shadows for a limited number
34+
// of lights depending on the implementation, platform, and user settings.
35+
// default
36+
// for point/spotlights: false / off
37+
// for global directional light: true / on
38+
optional bool shadows = 3;
39+
// light color
40+
// default White
41+
optional decentraland.common.Color3 color = 4;
42+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
4+
import "decentraland/sdk/components/common/id.proto";
5+
option (common.ecs_component_id) = 1075;
6+
7+
// PBMainCamera.virtualCameraEntity defines which VirtualCamera entity is active at the moment.
8+
// This component may hold 'repeated common.CameraTransition' transitionOverrides in the future
9+
message PBMainCamera {
10+
optional uint32 virtual_camera_entity = 1; // current active virtual camera
11+
}

proto/decentraland/sdk/components/material.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ message PBMaterial {
2222
optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
2323
optional bool cast_shadows = 3; // default = true
2424
optional decentraland.common.Color4 diffuse_color = 4; // default = white;
25+
optional decentraland.common.TextureUnion alpha_texture = 5; // default = null. Note that tilling and offset properties are ignored for this texture.
2526
}
2627

2728
message PbrMaterial {
@@ -30,9 +31,9 @@ message PBMaterial {
3031
optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
3132
optional bool cast_shadows = 3; // default = true
3233

33-
optional decentraland.common.TextureUnion alpha_texture = 4; // default = null
34-
optional decentraland.common.TextureUnion emissive_texture = 5; // default = null
35-
optional decentraland.common.TextureUnion bump_texture = 6; // default = null
34+
optional decentraland.common.TextureUnion alpha_texture = 4; // @deprecated Alpha textures are no longer supported on PBRMaterial and UnlitMaterial.alphaTexture should be used instead.
35+
optional decentraland.common.TextureUnion emissive_texture = 5; // default = null. Note that tilling and offset properties are ignored for this texture.
36+
optional decentraland.common.TextureUnion bump_texture = 6; // default = null. Note that tilling and offset properties are ignored for this texture.
3637

3738
optional decentraland.common.Color4 albedo_color = 7; // default = white;
3839
optional decentraland.common.Color3 emissive_color = 8; // default = black;

proto/decentraland/sdk/components/pointer_events.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ message PBPointerEvents {
2525
optional common.InputAction button = 1; // key/button in use (default IA_ANY)
2626
optional string hover_text = 2; // feedback on hover (default 'Interact')
2727
optional float max_distance = 3; // range of interaction (default 10)
28-
optional bool show_feedback = 4; // enable or disable hover text (default true)
28+
optional bool show_feedback = 4; // enable or disable hover text and highlight (default true)
29+
optional bool show_highlight = 5; // enable or disable hover highlight (default true)
2930
}
3031

3132
message Entry {

proto/decentraland/sdk/components/realm_info.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ message PBRealmInfo {
1111
string comms_adapter = 4;
1212
bool is_preview = 5;
1313
optional string room = 6;
14+
optional bool is_connected_scene_room = 7;
1415
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
4+
import "decentraland/sdk/components/common/id.proto";
5+
option (common.ecs_component_id) = 1205;
6+
7+
// defines a spotlight.
8+
// spotlights are point lights that emit light only in a cone around the transform's forward direction.
9+
// add this component together with the PBLight component to transform a point light into a spotlight.
10+
// note that spotlights do not model any internal reflections / focus, they only restrict the area of effect.
11+
// so for e.g. a torch beam, the bulb illuminance should be multiplied by the solid angle.
12+
// a typical torch with a beam width of 15 degrees would use outer angle of 0.15 (7.5 degrees in radians),
13+
// and an illuminance approximately equal to the bulb's lumens, e.g. 1200.
14+
message PBSpotlight {
15+
// the cone radius in radians. distance away from forward in which the light is visible.
16+
// for a torch a value around 0.15 is appropriate.
17+
float angle = 1;
18+
// optional angle at which the light is brightest. should be <= outer angle.
19+
// if specified, the light will fall off smoothly between `inner_angle` and `angle`.
20+
optional float inner_angle = 2;
21+
}

proto/decentraland/sdk/components/tween.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ message PBTween {
1515
Move move = 3;
1616
Rotate rotate = 4;
1717
Scale scale = 5;
18+
TextureMove texture_move = 8;
1819
}
1920

2021
optional bool playing = 6; // default true (pause or running)
@@ -37,6 +38,19 @@ message Scale {
3738
decentraland.common.Vector3 end = 2;
3839
}
3940

41+
// This tween mode allows to move the texture of a PbrMaterial or UnlitMaterial.
42+
// You can also specify the movement type (offset or tiling)
43+
message TextureMove {
44+
decentraland.common.Vector2 start = 1;
45+
decentraland.common.Vector2 end = 2;
46+
optional TextureMovementType movement_type = 3; // default = TextureMovementType.TMT_OFFSET
47+
}
48+
49+
enum TextureMovementType {
50+
TMT_OFFSET = 0; // default = TextureMovementType.TMT_OFFSET
51+
TMT_TILING = 1;
52+
}
53+
4054
// Implementation guidelines for these easing functions can be found
4155
// at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
4256
enum EasingFunction {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
3+
import "decentraland/sdk/components/common/id.proto";
4+
package decentraland.sdk.components;
5+
6+
option (common.ecs_component_id) = 1203;
7+
8+
import "decentraland/common/colors.proto";
9+
10+
// The UiCanvas component can be attached to a ui root entity to specify properties of the ui texture.
11+
message PBUiCanvas {
12+
uint32 width = 1;
13+
uint32 height = 2;
14+
15+
optional decentraland.common.Color4 color = 3; // default = (0.0, 0.0, 0.0, 0.0) / transparent
16+
}

proto/decentraland/sdk/components/ui_transform.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,6 @@ message PBUiTransform {
166166

167167
optional ScrollPositionValue scroll_position = 55; // default position=(0,0)
168168
optional ShowScrollBar scroll_visible = 56; // default ShowScrollBar.SSB_BOTH
169+
170+
optional int32 z_index = 57; // default 0
169171
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package decentraland.sdk.components;
3+
4+
import "decentraland/sdk/components/common/camera_transition.proto";
5+
import "decentraland/sdk/components/common/id.proto";
6+
option (common.ecs_component_id) = 1076;
7+
8+
// PBVirtualCamera represents a camera to be used at some point in time during the scene execution
9+
// * The defaultTransition represents the transition TOWARDS this camera. If there is none, it's treated as
10+
// an 'instant' transition (like using speed/time = 0)
11+
// * The lookAtEntity defines to which entity the Camera has to look at constantly (independent from
12+
// the holding entity transform).
13+
message PBVirtualCamera {
14+
optional common.CameraTransition default_transition = 1;
15+
optional uint32 look_at_entity = 2;
16+
}

scripts/check-component-id.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Usage: make check-component-id ID=<id>"
5+
exit 1
6+
fi
7+
8+
id=$1
9+
10+
matches=$(find . -name "*.proto" -exec grep -l "option (common\.ecs_component_id) = $id;" {} +)
11+
12+
if [ -z "$matches" ]; then
13+
echo "id $id is free"
14+
else
15+
echo "id $id is taken"
16+
fi

scripts/list-components-ids.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
ids=$(find . -name "*.proto" -exec grep -ho 'option (common\.ecs_component_id) = [0-9]\+;' {} + | sed -E 's/.*= ([0-9]+);/\1/' | sort -n)
4+
5+
count=$(echo "$ids" | wc -l | xargs)
6+
7+
echo "List of ids ($count total):"
8+
9+
i=1
10+
echo "$ids" | while read id; do
11+
echo "$i. $id"
12+
((i++))
13+
done
14+

0 commit comments

Comments
 (0)