| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL |
| | 4 | | { |
| | 5 | | public readonly struct AssetPromise_Material_Model |
| | 6 | | { |
| | 7 | | public enum TransparencyMode |
| | 8 | | { |
| | 9 | | Opaque = 0, |
| | 10 | | AlphaTest = 1, |
| | 11 | | AlphaBlend = 2, |
| | 12 | | AlphaTestAndAlphaBlend = 3, |
| | 13 | | Auto = 4 |
| | 14 | | } |
| | 15 | |
|
| | 16 | | public readonly struct Texture |
| | 17 | | { |
| | 18 | | public readonly string src; |
| | 19 | | public readonly TextureWrapMode wrapMode; |
| | 20 | | public readonly FilterMode filterMode; |
| | 21 | |
|
| | 22 | | public Texture(string src, TextureWrapMode wrapMode, FilterMode filterMode) |
| | 23 | | { |
| 26 | 24 | | this.src = src; |
| 26 | 25 | | this.wrapMode = wrapMode; |
| 26 | 26 | | this.filterMode = filterMode; |
| 26 | 27 | | } |
| | 28 | | } |
| | 29 | |
|
| | 30 | | public readonly bool isPbrMaterial; |
| | 31 | | public readonly Texture? albedoTexture; |
| | 32 | | public readonly float alphaTest; |
| | 33 | |
|
| | 34 | | public readonly Texture? alphaTexture; |
| | 35 | | public readonly Texture? emissiveTexture; |
| | 36 | | public readonly Texture? bumpTexture; |
| | 37 | |
|
| | 38 | | public readonly Color albedoColor; |
| | 39 | | public readonly Color emissiveColor; |
| | 40 | | public readonly Color reflectivityColor; |
| | 41 | |
|
| | 42 | | public readonly TransparencyMode transparencyMode; |
| | 43 | |
|
| | 44 | | public readonly float metallic; |
| | 45 | | public readonly float roughness; |
| | 46 | | public readonly float glossiness; |
| | 47 | |
|
| | 48 | | public readonly float specularIntensity; |
| | 49 | | public readonly float emissiveIntensity; |
| | 50 | | public readonly float directIntensity; |
| | 51 | |
|
| | 52 | | public static AssetPromise_Material_Model CreateBasicMaterial(Texture albedoTexture, float alphaTest) |
| | 53 | | { |
| 26 | 54 | | Color defaultColor = Color.white; |
| 26 | 55 | | return new AssetPromise_Material_Model(false, albedoTexture, null, null, null, |
| | 56 | | alphaTest, defaultColor, defaultColor, defaultColor, TransparencyMode.Auto, |
| | 57 | | 0, 0, 0, 0, 0, 0); |
| | 58 | | } |
| | 59 | |
|
| | 60 | | public static AssetPromise_Material_Model CreatePBRMaterial(Texture? albedoTexture, Texture? alphaTexture, |
| | 61 | | Texture? emissiveTexture, Texture? bumpTexture, float alphaTest, Color albedoColor, Color emissiveColor, |
| | 62 | | Color reflectivityColor, TransparencyMode transparencyMode, float metallic, float roughness, float glossines |
| | 63 | | float specularIntensity, float emissiveIntensity, float directIntensity) |
| | 64 | | { |
| 0 | 65 | | return new AssetPromise_Material_Model(true, albedoTexture, alphaTexture, |
| | 66 | | emissiveTexture, bumpTexture, alphaTest, albedoColor, emissiveColor, |
| | 67 | | reflectivityColor, transparencyMode, metallic, roughness, glossiness, |
| | 68 | | specularIntensity, emissiveIntensity, directIntensity); |
| | 69 | | } |
| | 70 | |
|
| | 71 | | public AssetPromise_Material_Model(bool isPbrMaterial, Texture? albedoTexture, Texture? alphaTexture, |
| | 72 | | Texture? emissiveTexture, Texture? bumpTexture, float alphaTest, Color albedoColor, Color emissiveColor, |
| | 73 | | Color reflectivityColor, TransparencyMode transparencyMode, float metallic, float roughness, float glossines |
| | 74 | | float specularIntensity, float emissiveIntensity, float directIntensity) |
| | 75 | | { |
| 26 | 76 | | this.isPbrMaterial = isPbrMaterial; |
| 26 | 77 | | this.albedoTexture = albedoTexture; |
| 26 | 78 | | this.alphaTexture = alphaTexture; |
| 26 | 79 | | this.emissiveTexture = emissiveTexture; |
| 26 | 80 | | this.bumpTexture = bumpTexture; |
| 26 | 81 | | this.alphaTest = alphaTest; |
| 26 | 82 | | this.albedoColor = albedoColor; |
| 26 | 83 | | this.emissiveColor = emissiveColor; |
| 26 | 84 | | this.reflectivityColor = reflectivityColor; |
| 26 | 85 | | this.transparencyMode = transparencyMode; |
| 26 | 86 | | this.metallic = metallic; |
| 26 | 87 | | this.roughness = roughness; |
| 26 | 88 | | this.glossiness = glossiness; |
| 26 | 89 | | this.specularIntensity = specularIntensity; |
| 26 | 90 | | this.emissiveIntensity = emissiveIntensity; |
| 26 | 91 | | this.directIntensity = directIntensity; |
| 26 | 92 | | } |
| | 93 | | } |
| | 94 | | } |