Skip to content

Commit

Permalink
feat: texture mapping movement tween support (#230)
Browse files Browse the repository at this point in the history
* Introduced new Tween mode and temporary extra params for testing stretch goals

* Fixed lint pass

* More lint pass fix

* Fixed texture move start and end value type

* Fixed wrong property type

* Removed wip properties for stretch goals of the shape

* Added documentation

* Updated documentation

* Improved documentation. Added support for texture tween
  • Loading branch information
AlejandroAlvarezMelucciDCL authored Nov 21, 2024
1 parent c886080 commit 3fb0262
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
6 changes: 2 additions & 4 deletions proto/decentraland/common/texture.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ message Texture {
optional TextureFilterMode filter_mode = 3; // default = FilterMode.Bilinear

// Final uv = offset + (input_uv * tiling)
// Offset for texture positioning.
optional Vector2 offset = 4; // default = Vector2.Zero
// Tiling multiplier for texture repetition.
optional Vector2 tiling = 5; // default = Vector2.One
optional Vector2 offset = 4; // default = Vector2.Zero; Offset for texture positioning, only works for the texture property in PbrMaterial or UnlitMaterial.
optional Vector2 tiling = 5; // default = Vector2.One; Tiling multiplier for texture repetition, only works for the texture property in PbrMaterial or UnlitMaterial.
}

message AvatarTexture {
Expand Down
13 changes: 6 additions & 7 deletions proto/decentraland/sdk/components/material.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ message PBMaterial {
optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
optional bool cast_shadows = 3; // default = true
optional decentraland.common.Color4 diffuse_color = 4; // default = white;
optional decentraland.common.TextureUnion alpha_texture = 5; // default = null
optional decentraland.common.TextureUnion alpha_texture = 5; // default = null. Note that tilling and offset properties are ignored for this texture.
}

message PbrMaterial {
optional decentraland.common.TextureUnion texture = 1; // default = null

optional float alpha_test = 2; // default = 0.5. range value: from 0 to 1
optional bool cast_shadows = 3; // default = true
// @deprecated Alpha textures are no longer supported on PBRMaterial and UnlitMaterial.alphaTexture should be used instead.
optional decentraland.common.TextureUnion alpha_texture = 4; // default = null
optional decentraland.common.TextureUnion emissive_texture = 5; // default = null
optional decentraland.common.TextureUnion bump_texture = 6; // default = null

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

optional decentraland.common.Color4 albedo_color = 7; // default = white;
optional decentraland.common.Color3 emissive_color = 8; // default = black;
Expand All @@ -54,5 +54,4 @@ message PBMaterial {
UnlitMaterial unlit = 1;
PbrMaterial pbr = 2;
}

}
}
14 changes: 14 additions & 0 deletions proto/decentraland/sdk/components/tween.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ message PBTween {
Move move = 3;
Rotate rotate = 4;
Scale scale = 5;
TextureMove texture_move = 8;
}

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

// This tween mode allows to move the texture of a PbrMaterial or UnlitMaterial.
// You can also specify the movement type (offset or tiling)
message TextureMove {
decentraland.common.Vector2 start = 1;
decentraland.common.Vector2 end = 2;
optional TextureMovementType movement_type = 3; // default = TextureMovementType.TMT_OFFSET
}

enum TextureMovementType {
TMT_OFFSET = 0; // default = TextureMovementType.TMT_OFFSET
TMT_TILING = 1;
}

// Implementation guidelines for these easing functions can be found
// at https://github.com/ai/easings.net/blob/6fcd5f852a470bf1a7890e8178afa0f471d5f2ec/src/easings/easingsFunctions.ts
enum EasingFunction {
Expand Down

0 comments on commit 3fb0262

Please sign in to comment.