| | 1 | | using DCL.Controllers; |
| | 2 | | using Decentraland.Common; |
| | 3 | |
|
| | 4 | | namespace DCL.ECSComponents |
| | 5 | | { |
| | 6 | | public static class Texture_Defaults |
| | 7 | | { |
| | 8 | | public static string GetTextureUrl(this TextureUnion self, IParcelScene scene) |
| | 9 | | { |
| 13 | 10 | | switch (self.TexCase) |
| | 11 | | { |
| | 12 | | case TextureUnion.TexOneofCase.AvatarTexture: |
| 1 | 13 | | return self.AvatarTexture.GetTextureUrl(); |
| | 14 | | case TextureUnion.TexOneofCase.Texture: |
| | 15 | | default: |
| 12 | 16 | | return self.Texture.GetTextureUrl(scene); |
| | 17 | | } |
| | 18 | | } |
| | 19 | |
|
| | 20 | | public static UnityEngine.TextureWrapMode GetWrapMode(this TextureUnion self) |
| | 21 | | { |
| 13 | 22 | | switch (self.TexCase) |
| | 23 | | { |
| | 24 | | case TextureUnion.TexOneofCase.AvatarTexture: |
| 1 | 25 | | return self.AvatarTexture.GetWrapMode(); |
| | 26 | | case TextureUnion.TexOneofCase.Texture: |
| | 27 | | default: |
| 12 | 28 | | return self.Texture.GetWrapMode(); |
| | 29 | | } |
| | 30 | | } |
| | 31 | |
|
| | 32 | | public static UnityEngine.FilterMode GetFilterMode(this TextureUnion self) |
| | 33 | | { |
| 13 | 34 | | switch (self.TexCase) |
| | 35 | | { |
| | 36 | | case TextureUnion.TexOneofCase.AvatarTexture: |
| 1 | 37 | | return self.AvatarTexture.GetFilterMode(); |
| | 38 | | case TextureUnion.TexOneofCase.Texture: |
| | 39 | | default: |
| 12 | 40 | | return self.Texture.GetFilterMode(); |
| | 41 | | } |
| | 42 | | } |
| | 43 | |
|
| | 44 | | public static string GetTextureUrl(this Decentraland.Common.Texture self, IParcelScene scene) |
| | 45 | | { |
| 12 | 46 | | if (string.IsNullOrEmpty(self.Src)) |
| 2 | 47 | | return self.Src; |
| | 48 | |
|
| 10 | 49 | | scene.contentProvider.TryGetContentsUrl(self.Src, out string textureUrl); |
| | 50 | |
|
| 10 | 51 | | return textureUrl; |
| | 52 | | } |
| | 53 | |
|
| | 54 | | public static string GetTextureUrl(this AvatarTexture self) |
| | 55 | | { |
| 1 | 56 | | return KernelConfig.i.Get().avatarTextureAPIBaseUrl + self.UserId; |
| | 57 | | } |
| | 58 | |
|
| | 59 | | public static UnityEngine.TextureWrapMode GetWrapMode(this Decentraland.Common.Texture self) |
| | 60 | | { |
| 12 | 61 | | return (UnityEngine.TextureWrapMode)(self.HasWrapMode ? self.WrapMode : TextureWrapMode.TwmClamp); |
| | 62 | | } |
| | 63 | |
|
| | 64 | | public static UnityEngine.TextureWrapMode GetWrapMode(this AvatarTexture self) |
| | 65 | | { |
| 1 | 66 | | return (UnityEngine.TextureWrapMode)(self.HasWrapMode ? self.WrapMode : TextureWrapMode.TwmClamp); |
| | 67 | | } |
| | 68 | |
|
| | 69 | | public static UnityEngine.FilterMode GetFilterMode(this Decentraland.Common.Texture self) |
| | 70 | | { |
| 12 | 71 | | return (UnityEngine.FilterMode)(self.HasFilterMode ? self.FilterMode : TextureFilterMode.TfmBilinear); |
| | 72 | | } |
| | 73 | |
|
| | 74 | | public static UnityEngine.FilterMode GetFilterMode(this AvatarTexture self) |
| | 75 | | { |
| 1 | 76 | | return (UnityEngine.FilterMode)(self.HasFilterMode ? self.FilterMode : TextureFilterMode.TfmBilinear); |
| | 77 | | } |
| | 78 | | } |
| | 79 | | } |