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