public static Texture2D Process(Texture tex, Texture tex2, TProcessor2 func) { if (tex == null) { throw new ArgumentNullException("tex is null"); } if (tex2 == null) { throw new ArgumentNullException("tex2 is null"); } if (func == null) { throw new ArgumentNullException("func is null"); } Texture2D nodeTex = tex.TryMakeReadable(); Texture2D segTex = tex2.TryMakeReadable(); Texture2D newTexture = func(nodeTex, segTex); newTexture.anisoLevel = nodeTex.anisoLevel; //newTexture.Compress(true); newTexture.name = tex.name + "-" + Extensions.GetPrettyFunctionName(func.Method); return(newTexture); }
public static void Process(Material nodeMaterial, Material segmentMaterial, string name, TProcessor2 func) { Texture2D nodeTex = nodeMaterial.GetReadableTexture(name); Texture2D segTex = segmentMaterial.GetReadableTexture(name); Texture2D newTexture = func(nodeTex, segTex); newTexture.anisoLevel = nodeTex.anisoLevel; newTexture.Compress(true); nodeMaterial.SetTexture(name, newTexture); }