private Texture2D CreateTexture() { if (this.entries.Count <= 0) { return((Texture2D)null); } int length = 32; int num1 = Mathf.Max(this.entries.Count, 64); this.ReleaseTexture(); this.texture = new Texture2D(length, num1, (TextureFormat)17, false, true); ((Object)this.texture).set_name("SubsurfaceProfiles"); ((UnityEngine.Texture) this.texture).set_wrapMode((TextureWrapMode)1); ((UnityEngine.Texture) this.texture).set_filterMode((FilterMode)1); Color[] pixels = this.texture.GetPixels(0); for (int index = 0; index < pixels.Length; ++index) { pixels[index] = Color.get_clear(); } Color[] target = new Color[length]; for (int index1 = 0; index1 < this.entries.Count; ++index1) { SubsurfaceProfileData data = this.entries[index1].data; data.SubsurfaceColor = SubsurfaceProfileTexture.ColorClamp(data.SubsurfaceColor, 0.0f, 1f); data.FalloffColor = SubsurfaceProfileTexture.ColorClamp(data.FalloffColor, 0.009f, 1f); target[0] = data.SubsurfaceColor; target[0].a = (__Null)0.0; SeparableSSS.CalculateKernel(target, 1, 13, data.SubsurfaceColor, data.FalloffColor); SeparableSSS.CalculateKernel(target, 14, 9, data.SubsurfaceColor, data.FalloffColor); SeparableSSS.CalculateKernel(target, 23, 6, data.SubsurfaceColor, data.FalloffColor); int num2 = length * (num1 - index1 - 1); for (int index2 = 0; index2 < 29; ++index2) { Color color = Color.op_Multiply(target[index2], new Color(1f, 1f, 1f, 0.3333333f)); ref __Null local = ref color.a;
private Texture2D CreateTexture() { if (this.entries.Count <= 0) { return(null); } int num = 32; int num1 = Mathf.Max(this.entries.Count, 64); this.ReleaseTexture(); this.texture = new Texture2D(num, num1, TextureFormat.RGBAHalf, false, true) { name = "SubsurfaceProfiles", wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear }; Color[] pixels = this.texture.GetPixels(0); for (int i = 0; i < (int)pixels.Length; i++) { pixels[i] = Color.clear; } Color[] subsurfaceColor = new Color[num]; for (int j = 0; j < this.entries.Count; j++) { SubsurfaceProfileData item = this.entries[j].data; item.SubsurfaceColor = SubsurfaceProfileTexture.ColorClamp(item.SubsurfaceColor, 0f, 1f); item.FalloffColor = SubsurfaceProfileTexture.ColorClamp(item.FalloffColor, 0.009f, 1f); subsurfaceColor[0] = item.SubsurfaceColor; subsurfaceColor[0].a = 0f; SeparableSSS.CalculateKernel(subsurfaceColor, 1, 13, item.SubsurfaceColor, item.FalloffColor); SeparableSSS.CalculateKernel(subsurfaceColor, 14, 9, item.SubsurfaceColor, item.FalloffColor); SeparableSSS.CalculateKernel(subsurfaceColor, 23, 6, item.SubsurfaceColor, item.FalloffColor); int num2 = num * (num1 - j - 1); for (int k = 0; k < 29; k++) { Color color = subsurfaceColor[k] * new Color(1f, 1f, 1f, 0.333333343f); ref float scatterRadius = ref color.a; scatterRadius = scatterRadius * (item.ScatterRadius / 1024f); pixels[num2 + k] = color; } }
static SubsurfaceProfile() { SubsurfaceProfile.profileTexture = new SubsurfaceProfileTexture(); }