From 5018cb8dc3ccac349825396091e82069302ec5af Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Tue, 10 Dec 2024 09:04:22 -0300 Subject: [PATCH 01/16] Initial draft of LightSource component --- proto/decentraland/sdk/components/light.proto | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 proto/decentraland/sdk/components/light.proto diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto new file mode 100644 index 00000000..83170064 --- /dev/null +++ b/proto/decentraland/sdk/components/light.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package decentraland.sdk.components; +import "decentraland/sdk/components/common/id.proto"; +import "decentraland/common/colors.proto"; +option (common.ecs_component_id) = 1079; + +message PBLightSource { + optional Type type = 1; + bool active = 5; // default = true + Color color = 2; // default = Color.white + float brightness = 3; // range from 0 to 1 + float range = 4; // default = 10. range value: from 0 to 1 + ShadowType shadow = 6; // default = ShadowType.ST_NONE + + message Point { + } + + message Spot{ + float inner_angle = 1; + float outer_angle = 2; + } + + oneof Type { + Point point = 1; + Spot spot = 2; + } + + enum ShadowType { + ST_NONE = 0; + ST_SOFT = 1; + ST_HARD = 2; + } +} From f228c65dd48229c22f087a11aec84afa73b820ae Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 14:13:00 -0300 Subject: [PATCH 02/16] Fixed conflicting ids --- proto/decentraland/sdk/components/light.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index 83170064..0ff18abc 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -16,8 +16,8 @@ message PBLightSource { } message Spot{ - float inner_angle = 1; - float outer_angle = 2; + float inner_angle = 7; + float outer_angle = 8; } oneof Type { From 2b6aa15c33573299d7b848e8b50a446e2d7db138 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 16:32:37 -0300 Subject: [PATCH 03/16] Refactor structure --- proto/decentraland/sdk/components/light.proto | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index 0ff18abc..ab310732 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -5,29 +5,26 @@ import "decentraland/common/colors.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - optional Type type = 1; - bool active = 5; // default = true - Color color = 2; // default = Color.white - float brightness = 3; // range from 0 to 1 - float range = 4; // default = 10. range value: from 0 to 1 - ShadowType shadow = 6; // default = ShadowType.ST_NONE - - message Point { - } + optional Type type = 1; + bool active = 5; // default = true + Color color = 2; // default = Color.white + float brightness = 3; // range from 0 to 1 + float range = 4; // default = 10. range value: from 0 to 1 + ShadowType shadow = 6; // default = ShadowType.ST_NONE - message Spot{ - float inner_angle = 7; - float outer_angle = 8; - } + oneof Type { + Point point = 1; + Spot spot = 2; + } +} +message Point {} - oneof Type { - Point point = 1; - Spot spot = 2; - } - - enum ShadowType { - ST_NONE = 0; - ST_SOFT = 1; - ST_HARD = 2; - } +message Spot { + float inner_angle = 1; + float outer_angle = 2; +} +enum ShadowType { + ST_NONE = 0; + ST_SOFT = 1; + ST_HARD = 2; } From 56a67a41245b0e76537565a712f04fa8004f517e Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 16:36:04 -0300 Subject: [PATCH 04/16] Fixed ids --- proto/decentraland/sdk/components/light.proto | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index ab310732..c5741f8f 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -13,16 +13,18 @@ message PBLightSource { ShadowType shadow = 6; // default = ShadowType.ST_NONE oneof Type { - Point point = 1; - Spot spot = 2; + Point point = 7; + Spot spot = 8; } } + message Point {} message Spot { float inner_angle = 1; float outer_angle = 2; } + enum ShadowType { ST_NONE = 0; ST_SOFT = 1; From 7034d1337044f97037e656c55d8cdee3638fcaab Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 16:39:04 -0300 Subject: [PATCH 05/16] Removed unused property and adjusted ids again --- proto/decentraland/sdk/components/light.proto | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index c5741f8f..0ed2fead 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -5,16 +5,15 @@ import "decentraland/common/colors.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - optional Type type = 1; - bool active = 5; // default = true - Color color = 2; // default = Color.white - float brightness = 3; // range from 0 to 1 - float range = 4; // default = 10. range value: from 0 to 1 - ShadowType shadow = 6; // default = ShadowType.ST_NONE + bool active = 4; // default = true + Color color = 1; // default = Color.white + float brightness = 2; // range from 0 to 1 + float range = 3; // default = 10. range value: from 0 to 1 + ShadowType shadow = 5; // default = ShadowType.ST_NONE oneof Type { - Point point = 7; - Spot spot = 8; + Point point = 6; + Spot spot = 7; } } From a1b18622de1605afb9cc68e744f3fb1e61cad854 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 16:41:03 -0300 Subject: [PATCH 06/16] Fixed color reference --- proto/decentraland/sdk/components/light.proto | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index 0ed2fead..8f578066 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -5,11 +5,11 @@ import "decentraland/common/colors.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - bool active = 4; // default = true - Color color = 1; // default = Color.white - float brightness = 2; // range from 0 to 1 - float range = 3; // default = 10. range value: from 0 to 1 - ShadowType shadow = 5; // default = ShadowType.ST_NONE + bool active = 4; // default = true + decentraland.common.Color3 color = 1; // default = Color.white + float brightness = 2; // range from 0 to 1 + float range = 3; // default = 10. range value: from 0 to 1 + ShadowType shadow = 5; // default = ShadowType.ST_NONE oneof Type { Point point = 6; From 3c635098a212bdf6b5117606939c9f3a65e1e421 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Fri, 10 Jan 2025 16:44:47 -0300 Subject: [PATCH 07/16] Fixed lowecase to oneof name --- proto/decentraland/sdk/components/light.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index 8f578066..d3ee5840 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -11,7 +11,7 @@ message PBLightSource { float range = 3; // default = 10. range value: from 0 to 1 ShadowType shadow = 5; // default = ShadowType.ST_NONE - oneof Type { + oneof type { Point point = 6; Spot spot = 7; } From 649389b4051fee5ed2d4a88a0529b209219c4c5b Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Mon, 13 Jan 2025 13:10:19 -0300 Subject: [PATCH 08/16] Test to fix proto builds --- proto/decentraland/sdk/components/light.proto | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light.proto index d3ee5840..f9314b91 100644 --- a/proto/decentraland/sdk/components/light.proto +++ b/proto/decentraland/sdk/components/light.proto @@ -15,17 +15,17 @@ message PBLightSource { Point point = 6; Spot spot = 7; } -} -message Point {} + message Point {} -message Spot { - float inner_angle = 1; - float outer_angle = 2; -} + message Spot { + float inner_angle = 1; + float outer_angle = 2; + } -enum ShadowType { - ST_NONE = 0; - ST_SOFT = 1; - ST_HARD = 2; + enum ShadowType { + ST_NONE = 0; + ST_SOFT = 1; + ST_HARD = 2; + } } From 77138f9b2078aa27b38dcc05d15c0378321bed9b Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Mon, 13 Jan 2025 16:42:20 -0300 Subject: [PATCH 09/16] Renamed file to properly generate classes with the intended name --- .../sdk/components/{light.proto => light_source.proto} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename proto/decentraland/sdk/components/{light.proto => light_source.proto} (100%) diff --git a/proto/decentraland/sdk/components/light.proto b/proto/decentraland/sdk/components/light_source.proto similarity index 100% rename from proto/decentraland/sdk/components/light.proto rename to proto/decentraland/sdk/components/light_source.proto From e9cba8b45601745b2d277213a63c3101d29fdb25 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Tue, 21 Jan 2025 18:14:51 -0300 Subject: [PATCH 10/16] Updated documentation --- proto/decentraland/sdk/components/light_source.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index f9314b91..77b681ca 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -7,8 +7,8 @@ option (common.ecs_component_id) = 1079; message PBLightSource { bool active = 4; // default = true decentraland.common.Color3 color = 1; // default = Color.white - float brightness = 2; // range from 0 to 1 - float range = 3; // default = 10. range value: from 0 to 1 + float brightness = 2; // range from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot + float range = 3; // default = 10, expressed in meters ShadowType shadow = 5; // default = ShadowType.ST_NONE oneof type { @@ -19,8 +19,8 @@ message PBLightSource { message Point {} message Spot { - float inner_angle = 1; - float outer_angle = 2; + float inner_angle = 1; // default = 21.8. Inner angle can't be higher than outer angle, otherwise will default to same value. Min value is 0 + float outer_angle = 2; // 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 } enum ShadowType { From 0ef8a3c0ded7b516da25a92ae1d5a3a8d0e6b411 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Sun, 26 Jan 2025 20:42:55 -0300 Subject: [PATCH 11/16] Added cookie field --- proto/decentraland/sdk/components/light_source.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index 77b681ca..912d53db 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -10,6 +10,7 @@ message PBLightSource { float brightness = 2; // range from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot float range = 3; // default = 10, expressed in meters ShadowType shadow = 5; // default = ShadowType.ST_NONE + Texture cookies = 8; // (optional) Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. oneof type { Point point = 6; @@ -19,7 +20,7 @@ message PBLightSource { message Point {} message Spot { - float inner_angle = 1; // default = 21.8. Inner angle can't be higher than outer angle, otherwise will default to same value. Min value is 0 + float inner_angle = 1; // 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 float outer_angle = 2; // 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 } From 1020ea7347058382652f0332a4afed32aa7cbbf6 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Sun, 26 Jan 2025 21:01:30 -0300 Subject: [PATCH 12/16] Added missing import --- proto/decentraland/sdk/components/light_source.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index 912d53db..f2a189c9 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package decentraland.sdk.components; import "decentraland/sdk/components/common/id.proto"; import "decentraland/common/colors.proto"; +import "decentraland/common/texture.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { From f0aede8e718a6e1270e23d4ad21ffb084f7602d3 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Sun, 26 Jan 2025 21:04:18 -0300 Subject: [PATCH 13/16] Fixed proper type reference --- proto/decentraland/sdk/components/light_source.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index f2a189c9..dddb2ca1 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -11,7 +11,7 @@ message PBLightSource { float brightness = 2; // range from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot float range = 3; // default = 10, expressed in meters ShadowType shadow = 5; // default = ShadowType.ST_NONE - Texture cookies = 8; // (optional) Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. + decentraland.common.Texture cookies = 8; // (optional) Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. oneof type { Point point = 6; From 728a3acc6ade4322defc19aeb31497c1f3ef5e3d Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Sun, 26 Jan 2025 23:48:17 -0300 Subject: [PATCH 14/16] Set optional properties, improved documentation --- .../sdk/components/light_source.proto | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index dddb2ca1..cf08ad25 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -6,12 +6,12 @@ import "decentraland/common/texture.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - bool active = 4; // default = true - decentraland.common.Color3 color = 1; // default = Color.white - float brightness = 2; // range from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot - float range = 3; // default = 10, expressed in meters - ShadowType shadow = 5; // default = ShadowType.ST_NONE - decentraland.common.Texture cookies = 8; // (optional) Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. + optional bool active = 4; // default = true, whether the lightSource is active or not. + optional decentraland.common.Color3 color = 1; // 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. + optional float brightness = 2; // default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. + optional float range = 3; // default = 10, how far the light travels, expressed in meters. + optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. + optional decentraland.common.Texture shadow_mask_texture = 8; // Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. oneof type { Point point = 6; @@ -21,13 +21,13 @@ message PBLightSource { message Point {} message Spot { - float inner_angle = 1; // 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 - float outer_angle = 2; // 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 + optional float inner_angle = 1; // 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. + optional float outer_angle = 2; // 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. } enum ShadowType { - ST_NONE = 0; - ST_SOFT = 1; - ST_HARD = 2; + ST_NONE = 0; // No shadows are cast from this LightSource. + ST_SOFT = 1; // More realistic type of shadow that reduces block artifacts, noise or pixelation, but requires more processing. + ST_HARD = 2; // Less realistic type of shadow but more performant, uses hard edges. } } From 64bf6eb9fbc7d65026e032812fc65fd673235dad Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Tue, 28 Jan 2025 14:08:32 -0300 Subject: [PATCH 15/16] Updated shadow mask type to TextureUnion --- proto/decentraland/sdk/components/light_source.proto | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index cf08ad25..d7654eba 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -6,12 +6,12 @@ import "decentraland/common/texture.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - optional bool active = 4; // default = true, whether the lightSource is active or not. - optional decentraland.common.Color3 color = 1; // 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. - optional float brightness = 2; // default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. - optional float range = 3; // default = 10, how far the light travels, expressed in meters. - optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. - optional decentraland.common.Texture shadow_mask_texture = 8; // Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. + optional bool active = 4; // default = true, whether the lightSource is active or not. + optional decentraland.common.Color3 color = 1; // 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. + optional float brightness = 2; // default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. + optional float range = 3; // default = 10, how far the light travels, expressed in meters. + optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. + optional decentraland.common.TextureUnion shadow_mask_texture = 8; // Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. oneof type { Point point = 6; From 35c385b0ce967f7a286567edc3e80642c368968a Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci Date: Wed, 29 Jan 2025 22:30:34 -0300 Subject: [PATCH 16/16] Reordered properties to support different defaults on different messages --- .../sdk/components/light_source.proto | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/proto/decentraland/sdk/components/light_source.proto b/proto/decentraland/sdk/components/light_source.proto index d7654eba..67c9a3c9 100644 --- a/proto/decentraland/sdk/components/light_source.proto +++ b/proto/decentraland/sdk/components/light_source.proto @@ -6,23 +6,25 @@ import "decentraland/common/texture.proto"; option (common.ecs_component_id) = 1079; message PBLightSource { - optional bool active = 4; // default = true, whether the lightSource is active or not. - optional decentraland.common.Color3 color = 1; // 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. - optional float brightness = 2; // default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. - optional float range = 3; // default = 10, how far the light travels, expressed in meters. - optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. - optional decentraland.common.TextureUnion shadow_mask_texture = 8; // Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. + optional bool active = 4; // default = true, whether the lightSource is active or not. + optional decentraland.common.Color3 color = 1; // 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. + optional float brightness = 2; // default = 250, ranges from 1 (dim) to 100,000 (very bright), expressed in Lumens for Point and Spot. + optional float range = 3; // default = 10, how far the light travels, expressed in meters. oneof type { Point point = 6; Spot spot = 7; } - message Point {} + message Point { + optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. + } message Spot { - optional float inner_angle = 1; // 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. - optional float outer_angle = 2; // 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. + optional float inner_angle = 1; // 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. + optional float outer_angle = 2; // 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. + optional ShadowType shadow = 5; // default = ShadowType.ST_NONE The type of shadow the light source supports. + optional decentraland.common.TextureUnion shadow_mask_texture = 8; // Texture mask through which shadows are cast to simulate caustics, soft shadows, and light shapes such as light entering from a window. } enum ShadowType {