Decompiled source of NailedPlank v1.0.0
NailedPlank.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Xml; using System.Xml.Serialization; using BepInEx; using BepInEx.Logging; using HarmonyLib; using OtherLoader; using UnityEditor; using UnityEngine; using UnityEngine.Profiling; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Volksterism.NailedPlank; [BepInPlugin("Volksterism.NailedPlank", "NailedPlank", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class NailedPlankPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Volksterism.NailedPlank"); OtherLoader.RegisterDirectLoad(BasePath, "Volksterism.NailedPlank", "", "", "nailedplank", ""); } } public class TOD_Animation : MonoBehaviour { [Tooltip("How much to move the clouds when the camera moves.")] [TOD_Min(0f)] public float CameraMovement = 1f; [Tooltip("Wind direction in degrees.")] [TOD_Range(0f, 360f)] public float WindDegrees = 0f; [Tooltip("Speed of the wind that is acting on the clouds.")] [TOD_Min(0f)] public float WindSpeed = 1f; private TOD_Sky sky; public Vector3 CloudUV { get; set; } public Vector3 OffsetUV { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position * (CameraMovement * 0.0001f); Quaternion rotation = ((Component)this).transform.rotation; Quaternion val2 = Quaternion.Euler(0f, 0f - ((Quaternion)(ref rotation)).eulerAngles.y, 0f); return val2 * val; } } protected void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) sky = ((Component)this).GetComponent<TOD_Sky>(); CloudUV = new Vector3(Random.value, Random.value, Random.value); } protected void Update() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin((float)Math.PI / 180f * WindDegrees); float num2 = Mathf.Cos((float)Math.PI / 180f * WindDegrees); float num3 = 0.001f * Time.deltaTime; float num4 = WindSpeed * num3; float x = CloudUV.x; float y = CloudUV.y; float z = CloudUV.z; y += num3 * 0.1f; x -= num4 * num; z -= num4 * num2; x -= Mathf.Floor(x); y -= Mathf.Floor(y); z -= Mathf.Floor(z); CloudUV = new Vector3(x, y, z); sky.Components.BillboardTransform.localRotation = Quaternion.Euler(0f, y * 360f, 0f); } } [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public class TOD_MinAttribute : PropertyAttribute { public float min; public TOD_MinAttribute(float min) { this.min = min; } } [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public class TOD_MaxAttribute : PropertyAttribute { public float max; public TOD_MaxAttribute(float max) { this.max = max; } } [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public class TOD_RangeAttribute : PropertyAttribute { public float min; public float max; public TOD_RangeAttribute(float min, float max) { this.min = min; this.max = max; } } public class TOD_Billboard : MonoBehaviour { public float Altitude = 0f; public float Azimuth = 0f; public float Distance = 1f; public float Size = 1f; private T GetComponentInParents<T>() where T : Component { Transform val = ((Component)this).transform; T component = ((Component)val).GetComponent<T>(); while ((Object)(object)component == (Object)null && (Object)(object)val.parent != (Object)null) { val = val.parent; component = ((Component)val).GetComponent<T>(); } return component; } protected void OnValidate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) TOD_Sky componentInParents = GetComponentInParents<TOD_Sky>(); if (!((Object)(object)componentInParents == (Object)null)) { float theta = (90f - Altitude) * ((float)Math.PI / 180f); float phi = Azimuth * ((float)Math.PI / 180f); Vector3 val = componentInParents.OrbitalToUnity(Distance, theta, phi); if (((Component)this).transform.localPosition != val) { ((Component)this).transform.localPosition = val; } float num = 2f * Mathf.Tan((float)Math.PI / 90f * Size); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(num, num, num); if (((Component)this).transform.localScale != val2) { ((Component)this).transform.localScale = val2; } ((Component)this).transform.LookAt(((Component)componentInParents).transform.position, Vector3.up); } } } [ExecuteInEditMode] [RequireComponent(typeof(Camera))] [AddComponentMenu("Time of Day/Camera Main Script")] public class TOD_Camera : MonoBehaviour { public TOD_Sky sky; public bool DomePosToCamera = true; public Vector3 DomePosOffset = Vector3.zero; public bool DomeScaleToFarClip = true; public float DomeScaleFactor = 0.95f; private Camera cameraComponent = null; private Transform cameraTransform = null; public bool HDR => Object.op_Implicit((Object)(object)cameraComponent) && cameraComponent.allowHDR; public float NearClipPlane => (!Object.op_Implicit((Object)(object)cameraComponent)) ? 0.1f : cameraComponent.nearClipPlane; public float FarClipPlane => (!Object.op_Implicit((Object)(object)cameraComponent)) ? 1000f : cameraComponent.farClipPlane; public Color BackgroundColor => (!Object.op_Implicit((Object)(object)cameraComponent)) ? Color.black : cameraComponent.backgroundColor; protected void OnValidate() { DomeScaleFactor = Mathf.Clamp(DomeScaleFactor, 0.01f, 1f); } protected void OnEnable() { cameraComponent = ((Component)this).GetComponent<Camera>(); cameraTransform = ((Component)this).GetComponent<Transform>(); if (!Object.op_Implicit((Object)(object)sky)) { sky = FindSky(fallback: true); } } protected void Update() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)sky)) { sky = FindSky(); } if (Object.op_Implicit((Object)(object)sky) && sky.Initialized) { sky.Components.Camera = this; if ((int)cameraComponent.clearFlags != 2) { cameraComponent.clearFlags = (CameraClearFlags)2; } if (cameraComponent.backgroundColor != Color.clear) { cameraComponent.backgroundColor = Color.clear; } if ((Object)(object)RenderSettings.skybox != (Object)(object)sky.Resources.Skybox) { RenderSettings.skybox = sky.Resources.Skybox; DynamicGI.UpdateEnvironment(); } } } protected void OnPreCull() { if (!Object.op_Implicit((Object)(object)sky)) { sky = FindSky(); } if (Object.op_Implicit((Object)(object)sky) && sky.Initialized) { if (DomeScaleToFarClip) { DoDomeScaleToFarClip(); } if (DomePosToCamera) { DoDomePosToCamera(); } } } private TOD_Sky FindSky(bool fallback = false) { if (Object.op_Implicit((Object)(object)TOD_Sky.Instance)) { return TOD_Sky.Instance; } if (fallback) { return Object.FindObjectOfType(typeof(TOD_Sky)) as TOD_Sky; } return null; } public void DoDomeScaleToFarClip() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) float num = DomeScaleFactor * cameraComponent.farClipPlane; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num, num); if (sky.Components.DomeTransform.localScale != val) { sky.Components.DomeTransform.localScale = val; } } public void DoDomePosToCamera() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cameraTransform.position + cameraTransform.rotation * DomePosOffset; if (sky.Components.DomeTransform.position != val) { sky.Components.DomeTransform.position = val; } } } [ExecuteInEditMode] public class TOD_Components : MonoBehaviour { public GameObject Space = null; public GameObject Stars = null; public GameObject Sun = null; public GameObject Moon = null; public GameObject Atmosphere = null; public GameObject Clear = null; public GameObject Clouds = null; public GameObject Billboards = null; public GameObject Light = null; public Transform DomeTransform { get; set; } public Transform SpaceTransform { get; set; } public Transform StarTransform { get; set; } public Transform SunTransform { get; set; } public Transform MoonTransform { get; set; } public Transform AtmosphereTransform { get; set; } public Transform ClearTransform { get; set; } public Transform CloudTransform { get; set; } public Transform BillboardTransform { get; set; } public Transform LightTransform { get; set; } public Renderer SpaceRenderer { get; set; } public Renderer StarRenderer { get; set; } public Renderer SunRenderer { get; set; } public Renderer MoonRenderer { get; set; } public Renderer AtmosphereRenderer { get; set; } public Renderer ClearRenderer { get; set; } public Renderer CloudRenderer { get; set; } public Renderer[] BillboardRenderers { get; set; } public MeshFilter SpaceMeshFilter { get; set; } public MeshFilter StarMeshFilter { get; set; } public MeshFilter SunMeshFilter { get; set; } public MeshFilter MoonMeshFilter { get; set; } public MeshFilter AtmosphereMeshFilter { get; set; } public MeshFilter ClearMeshFilter { get; set; } public MeshFilter CloudMeshFilter { get; set; } public MeshFilter[] BillboardMeshFilters { get; set; } public Material SpaceMaterial { get; set; } public Material StarMaterial { get; set; } public Material SunMaterial { get; set; } public Material MoonMaterial { get; set; } public Material AtmosphereMaterial { get; set; } public Material ClearMaterial { get; set; } public Material CloudMaterial { get; set; } public Material[] BillboardMaterials { get; set; } public Light LightSource { get; set; } public TOD_Sky Sky { get; set; } public TOD_Animation Animation { get; set; } public TOD_Time Time { get; set; } public TOD_Camera Camera { get; set; } public TOD_Rays Rays { get; set; } public TOD_Scattering Scattering { get; set; } public TOD_Shadows Shadows { get; set; } public void Initialize() { DomeTransform = ((Component)this).GetComponent<Transform>(); Sky = ((Component)this).GetComponent<TOD_Sky>(); Animation = ((Component)this).GetComponent<TOD_Animation>(); Time = ((Component)this).GetComponent<TOD_Time>(); if (Object.op_Implicit((Object)(object)Space)) { SpaceTransform = Space.GetComponent<Transform>(); SpaceRenderer = Space.GetComponent<Renderer>(); SpaceMeshFilter = Space.GetComponent<MeshFilter>(); SpaceMaterial = SpaceRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Stars)) { StarTransform = Stars.GetComponent<Transform>(); StarRenderer = Stars.GetComponent<Renderer>(); StarMeshFilter = Stars.GetComponent<MeshFilter>(); StarMaterial = StarRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Sun)) { SunTransform = Sun.GetComponent<Transform>(); SunRenderer = Sun.GetComponent<Renderer>(); SunMeshFilter = Sun.GetComponent<MeshFilter>(); SunMaterial = SunRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Moon)) { MoonTransform = Moon.GetComponent<Transform>(); MoonRenderer = Moon.GetComponent<Renderer>(); MoonMeshFilter = Moon.GetComponent<MeshFilter>(); MoonMaterial = MoonRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Atmosphere)) { AtmosphereTransform = Atmosphere.GetComponent<Transform>(); AtmosphereRenderer = Atmosphere.GetComponent<Renderer>(); AtmosphereMeshFilter = Atmosphere.GetComponent<MeshFilter>(); AtmosphereMaterial = AtmosphereRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Clear)) { ClearTransform = Clear.GetComponent<Transform>(); ClearRenderer = Clear.GetComponent<Renderer>(); ClearMeshFilter = Clear.GetComponent<MeshFilter>(); ClearMaterial = ClearRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Clouds)) { CloudTransform = Clouds.GetComponent<Transform>(); CloudRenderer = Clouds.GetComponent<Renderer>(); CloudMeshFilter = Clouds.GetComponent<MeshFilter>(); CloudMaterial = CloudRenderer.sharedMaterial; } if (Object.op_Implicit((Object)(object)Billboards)) { BillboardTransform = Billboards.GetComponent<Transform>(); BillboardRenderers = Billboards.GetComponentsInChildren<Renderer>(); BillboardMeshFilters = Billboards.GetComponentsInChildren<MeshFilter>(); BillboardMaterials = (Material[])(object)new Material[BillboardRenderers.Length]; for (int i = 0; i < BillboardRenderers.Length; i++) { BillboardMaterials[i] = BillboardRenderers[i].sharedMaterial; } } if (Object.op_Implicit((Object)(object)Light)) { LightTransform = Light.GetComponent<Transform>(); LightSource = Light.GetComponent<Light>(); } } } public enum TOD_MoonPositionType { OppositeToSun, Realistic } public enum TOD_StarsPositionType { Static, Rotating } public enum TOD_FogType { None, Atmosphere, Directional, Gradient } public enum TOD_AmbientType { None, Color, Gradient, Spherical } public enum TOD_ReflectionType { None, Cubemap } public enum TOD_ColorSpaceType { Auto, Linear, Gamma } public enum TOD_ColorRangeType { Auto, HDR, LDR } public enum TOD_ColorOutputType { Raw, Dithered } public enum TOD_CloudQualityType { Low, Medium, High } public enum TOD_MeshQualityType { Low, Medium, High } public enum TOD_StarQualityType { Low, Medium, High } public enum TOD_SkyQualityType { PerVertex, PerPixel } [ExecuteInEditMode] [RequireComponent(typeof(Camera))] public abstract class TOD_ImageEffect : MonoBehaviour { public enum ResolutionType { Low, Normal, High } public TOD_Sky sky = null; protected Camera cam = null; private static Vector3[] frustumCornersArray = (Vector3[])(object)new Vector3[4]; protected Material CreateMaterial(Shader shader) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)shader)) { Debug.Log((object)("Missing shader in " + ((object)this).ToString())); ((Behaviour)this).enabled = false; return null; } if (!shader.isSupported) { Debug.LogError((object)("The shader " + ((object)shader).ToString() + " on effect " + ((object)this).ToString() + " is not supported on this platform!")); ((Behaviour)this).enabled = false; return null; } Material val = new Material(shader); ((Object)val).hideFlags = (HideFlags)52; return val; } private TOD_Sky FindSky(bool fallback = false) { if (Object.op_Implicit((Object)(object)TOD_Sky.Instance)) { return TOD_Sky.Instance; } if (fallback) { return Object.FindObjectOfType(typeof(TOD_Sky)) as TOD_Sky; } return null; } protected void Awake() { if (!Object.op_Implicit((Object)(object)cam)) { cam = ((Component)this).GetComponent<Camera>(); } if (!Object.op_Implicit((Object)(object)sky)) { sky = FindSky(fallback: true); } } protected bool CheckSupport(bool needDepth = false, bool needHdr = false) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)cam)) { cam = ((Component)this).GetComponent<Camera>(); } if (!Object.op_Implicit((Object)(object)cam)) { return false; } if (!Object.op_Implicit((Object)(object)sky)) { sky = FindSky(); } if (!Object.op_Implicit((Object)(object)sky) || !sky.Initialized) { return false; } if (!SystemInfo.supportsImageEffects) { Debug.LogWarning((object)("The image effect " + ((object)this).ToString() + " has been disabled as it's not supported on the current platform.")); ((Behaviour)this).enabled = false; return false; } if (needDepth && !SystemInfo.SupportsRenderTextureFormat((RenderTextureFormat)1)) { Debug.LogWarning((object)("The image effect " + ((object)this).ToString() + " has been disabled as it requires a depth texture.")); ((Behaviour)this).enabled = false; return false; } if (needHdr && !SystemInfo.SupportsRenderTextureFormat((RenderTextureFormat)2)) { Debug.LogWarning((object)("The image effect " + ((object)this).ToString() + " has been disabled as it requires HDR.")); ((Behaviour)this).enabled = false; return false; } if (needDepth) { Camera obj = cam; obj.depthTextureMode = (DepthTextureMode)(obj.depthTextureMode | 1); } if (needHdr) { cam.allowHDR = true; } return true; } protected void DrawBorder(RenderTexture dest, Material material) { RenderTexture.active = dest; bool flag = true; GL.PushMatrix(); GL.LoadOrtho(); for (int i = 0; i < material.passCount; i++) { material.SetPass(i); float num; float num2; if (flag) { num = 1f; num2 = 0f; } else { num = 0f; num2 = 1f; } float num3 = 0f; float num4 = 1f / ((float)((Texture)dest).width * 1f); float num5 = 0f; float num6 = 1f; GL.Begin(7); GL.TexCoord2(0f, num); GL.Vertex3(num3, num5, 0.1f); GL.TexCoord2(1f, num); GL.Vertex3(num4, num5, 0.1f); GL.TexCoord2(1f, num2); GL.Vertex3(num4, num6, 0.1f); GL.TexCoord2(0f, num2); GL.Vertex3(num3, num6, 0.1f); num3 = 1f - 1f / ((float)((Texture)dest).width * 1f); num4 = 1f; num5 = 0f; num6 = 1f; GL.TexCoord2(0f, num); GL.Vertex3(num3, num5, 0.1f); GL.TexCoord2(1f, num); GL.Vertex3(num4, num5, 0.1f); GL.TexCoord2(1f, num2); GL.Vertex3(num4, num6, 0.1f); GL.TexCoord2(0f, num2); GL.Vertex3(num3, num6, 0.1f); num3 = 0f; num4 = 1f; num5 = 0f; num6 = 1f / ((float)((Texture)dest).height * 1f); GL.TexCoord2(0f, num); GL.Vertex3(num3, num5, 0.1f); GL.TexCoord2(1f, num); GL.Vertex3(num4, num5, 0.1f); GL.TexCoord2(1f, num2); GL.Vertex3(num4, num6, 0.1f); GL.TexCoord2(0f, num2); GL.Vertex3(num3, num6, 0.1f); num3 = 0f; num4 = 1f; num5 = 1f - 1f / ((float)((Texture)dest).height * 1f); num6 = 1f; GL.TexCoord2(0f, num); GL.Vertex3(num3, num5, 0.1f); GL.TexCoord2(1f, num); GL.Vertex3(num4, num5, 0.1f); GL.TexCoord2(1f, num2); GL.Vertex3(num4, num6, 0.1f); GL.TexCoord2(0f, num2); GL.Vertex3(num3, num6, 0.1f); GL.End(); } GL.PopMatrix(); } protected Matrix4x4 FrustumCorners() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) cam.CalculateFrustumCorners(new Rect(0f, 0f, 1f, 1f), cam.farClipPlane, cam.stereoActiveEye, frustumCornersArray); Vector3 val = ((Component)cam).transform.TransformVector(frustumCornersArray[0]); Vector3 val2 = ((Component)cam).transform.TransformVector(frustumCornersArray[1]); Vector3 val3 = ((Component)cam).transform.TransformVector(frustumCornersArray[2]); Vector3 val4 = ((Component)cam).transform.TransformVector(frustumCornersArray[3]); Matrix4x4 identity = Matrix4x4.identity; ((Matrix4x4)(ref identity)).SetRow(0, Vector4.op_Implicit(val)); ((Matrix4x4)(ref identity)).SetRow(1, Vector4.op_Implicit(val4)); ((Matrix4x4)(ref identity)).SetRow(2, Vector4.op_Implicit(val2)); ((Matrix4x4)(ref identity)).SetRow(3, Vector4.op_Implicit(val3)); return identity; } protected RenderTexture GetSkyMask(RenderTexture source, Material skyMaskMaterial, Material screenClearMaterial, ResolutionType resolution, Vector3 lightPos, int blurIterations, float blurRadius, float maxRadius) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) int num; int num2; int num3; switch (resolution) { case ResolutionType.High: num = ((Texture)source).width; num2 = ((Texture)source).height; num3 = 0; break; case ResolutionType.Normal: num = ((Texture)source).width / 2; num2 = ((Texture)source).height / 2; num3 = 0; break; default: num = ((Texture)source).width / 4; num2 = ((Texture)source).height / 4; num3 = 0; break; } RenderTexture temporary = RenderTexture.GetTemporary(num, num2, num3); RenderTexture val = null; skyMaskMaterial.SetVector("_BlurRadius4", new Vector4(1f, 1f, 0f, 0f) * blurRadius); skyMaskMaterial.SetVector("_LightPosition", new Vector4(lightPos.x, lightPos.y, lightPos.z, maxRadius)); if ((cam.depthTextureMode & 1) != 0) { Graphics.Blit((Texture)(object)source, temporary, skyMaskMaterial, 1); } else { Graphics.Blit((Texture)(object)source, temporary, skyMaskMaterial, 2); } if ((int)cam.stereoActiveEye == 2) { DrawBorder(temporary, screenClearMaterial); } float num4 = blurRadius * 0.0013020834f; skyMaskMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f)); skyMaskMaterial.SetVector("_LightPosition", new Vector4(lightPos.x, lightPos.y, lightPos.z, maxRadius)); for (int i = 0; i < blurIterations; i++) { val = RenderTexture.GetTemporary(num, num2, num3); Graphics.Blit((Texture)(object)temporary, val, skyMaskMaterial, 0); RenderTexture.ReleaseTemporary(temporary); num4 = blurRadius * (((float)i * 2f + 1f) * 6f) / 768f; skyMaskMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f)); temporary = RenderTexture.GetTemporary(num, num2, num3); Graphics.Blit((Texture)(object)val, temporary, skyMaskMaterial, 0); RenderTexture.ReleaseTemporary(val); num4 = blurRadius * (((float)i * 2f + 2f) * 6f) / 768f; skyMaskMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f)); } return temporary; } } [Serializable] public class TOD_Parameters { public TOD_CycleParameters Cycle; public TOD_WorldParameters World; public TOD_AtmosphereParameters Atmosphere; public TOD_DayParameters Day; public TOD_NightParameters Night; public TOD_SunParameters Sun; public TOD_MoonParameters Moon; public TOD_LightParameters Light; public TOD_StarParameters Stars; public TOD_CloudParameters Clouds; public TOD_FogParameters Fog; public TOD_AmbientParameters Ambient; public TOD_ReflectionParameters Reflection; public TOD_Parameters() { } public TOD_Parameters(TOD_Sky sky) { Cycle = sky.Cycle; World = sky.World; Atmosphere = sky.Atmosphere; Day = sky.Day; Night = sky.Night; Sun = sky.Sun; Moon = sky.Moon; Light = sky.Light; Stars = sky.Stars; Clouds = sky.Clouds; Fog = sky.Fog; Ambient = sky.Ambient; Reflection = sky.Reflection; } public void ToSky(TOD_Sky sky) { sky.Cycle = Cycle; sky.World = World; sky.Atmosphere = Atmosphere; sky.Day = Day; sky.Night = Night; sky.Sun = Sun; sky.Moon = Moon; sky.Light = Light; sky.Stars = Stars; sky.Clouds = Clouds; sky.Fog = Fog; sky.Ambient = Ambient; sky.Reflection = Reflection; } } [Serializable] public class TOD_CycleParameters { [Tooltip("Current hour of the day.")] public float Hour = 12f; [Tooltip("Current day of the month.")] public int Day = 15; [Tooltip("Current month of the year.")] public int Month = 6; [Tooltip("Current year.")] [TOD_Range(1f, 9999f)] public int Year = 2000; public DateTime DateTime { get { DateTime result = new DateTime(0L, DateTimeKind.Utc); if (Year > 0) { result = result.AddYears(Year - 1); } if (Month > 0) { result = result.AddMonths(Month - 1); } if (Day > 0) { result = result.AddDays(Day - 1); } if (Hour > 0f) { result = result.AddHours(Hour); } return result; } set { Year = value.Year; Month = value.Month; Day = value.Day; Hour = (float)value.Hour + (float)value.Minute / 60f + (float)value.Second / 3600f + (float)value.Millisecond / 3600000f; } } public long Ticks { get { return DateTime.Ticks; } set { DateTime = new DateTime(value, DateTimeKind.Utc); } } } [Serializable] public class TOD_WorldParameters { [Tooltip("Latitude of the current location in degrees.")] [Range(-90f, 90f)] public float Latitude = 0f; [Tooltip("Longitude of the current location in degrees.")] [Range(-180f, 180f)] public float Longitude = 0f; [Tooltip("UTC/GMT time zone of the current location in hours.")] [Range(-14f, 14f)] public float UTC = 0f; } [Serializable] public class TOD_AtmosphereParameters { [Tooltip("Intensity of the atmospheric Rayleigh scattering.")] [TOD_Min(0f)] public float RayleighMultiplier = 1f; [Tooltip("Intensity of the atmospheric Mie scattering.")] [TOD_Min(0f)] public float MieMultiplier = 1f; [Tooltip("Overall brightness of the atmosphere.")] [TOD_Min(0f)] public float Brightness = 1.5f; [Tooltip("Overall contrast of the atmosphere.")] [TOD_Min(0f)] public float Contrast = 1.5f; [Tooltip("Directionality factor that determines the size of the glow around the sun.")] [TOD_Range(0f, 1f)] public float Directionality = 0.7f; [Tooltip("Density of the fog covering the sky.")] [TOD_Range(0f, 1f)] public float Fogginess = 0f; } [Serializable] public class TOD_DayParameters { [Tooltip("Color of the sun spot.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient SunColor = null; [Tooltip("Color of the light that hits the ground.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient LightColor = null; [Tooltip("Color of the god rays.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient RayColor = null; [Tooltip("Color of the light that hits the atmosphere.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient SkyColor = null; [Tooltip("Color of the clouds.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient CloudColor = null; [Tooltip("Color of the atmosphere fog.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient FogColor = null; [Tooltip("Color of the ambient light.\nLeft value: Sun at zenith.\nRight value: Sun at horizon.")] public Gradient AmbientColor = null; [Tooltip("Intensity of the light source.")] [Range(0f, 8f)] public float LightIntensity = 1f; [Tooltip("Opacity of the shadows dropped by the light source.")] [Range(0f, 1f)] public float ShadowStrength = 1f; [Tooltip("Brightness multiplier of the ambient light.")] [Range(0f, 8f)] public float AmbientMultiplier = 1f; [Tooltip("Brightness multiplier of the reflection probe.")] [Range(0f, 1f)] public float ReflectionMultiplier = 1f; } [Serializable] public class TOD_NightParameters { [Tooltip("Color of the moon mesh.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient MoonColor = null; [Tooltip("Color of the light that hits the ground.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient LightColor = null; [Tooltip("Color of the god rays.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient RayColor = null; [Tooltip("Color of the light that hits the atmosphere.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient SkyColor = null; [Tooltip("Color of the clouds.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient CloudColor = null; [Tooltip("Color of the atmosphere fog.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient FogColor = null; [Tooltip("Color of the ambient light.\nLeft value: Sun at horizon.\nRight value: Sun opposite to zenith.")] public Gradient AmbientColor = null; [Tooltip("Intensity of the light source.")] [Range(0f, 8f)] public float LightIntensity = 0.1f; [Tooltip("Opacity of the shadows dropped by the light source.")] [Range(0f, 1f)] public float ShadowStrength = 1f; [Tooltip("Brightness multiplier of the ambient light.")] [Range(0f, 8f)] public float AmbientMultiplier = 1f; [Tooltip("Brightness multiplier of the reflection probe.")] [Range(0f, 1f)] public float ReflectionMultiplier = 1f; } [Serializable] public class TOD_SunParameters { [Tooltip("Diameter of the sun in degrees.\nThe diameter as seen from earth is 0.5 degrees.")] [TOD_Min(0f)] public float MeshSize = 1f; [Tooltip("Brightness of the sun.")] [TOD_Min(0f)] public float MeshBrightness = 2f; [Tooltip("Contrast of the sun.")] [TOD_Min(0f)] public float MeshContrast = 1f; } [Serializable] public class TOD_MoonParameters { [Tooltip("Diameter of the moon in degrees.\nThe diameter as seen from earth is 0.5 degrees.")] [TOD_Min(0f)] public float MeshSize = 1f; [Tooltip("Brightness of the moon.")] [TOD_Min(0f)] public float MeshBrightness = 2f; [Tooltip("Contrast of the moon.")] [TOD_Min(0f)] public float MeshContrast = 1f; [Tooltip("Size of the moon halo.")] [TOD_Min(0f)] public float HaloSize = 0.1f; [Tooltip("Brightness of the moon halo.")] [TOD_Min(0f)] public float HaloBrightness = 1f; [Tooltip("Type of the moon position calculation.")] public TOD_MoonPositionType Position = TOD_MoonPositionType.Realistic; } [Serializable] public class TOD_StarParameters { [Tooltip("Size of the stars.")] [TOD_Min(0f)] public float Size = 1f; [Tooltip("Brightness of the stars.")] [TOD_Min(0f)] public float Brightness = 1f; [Tooltip("Type of the stars position calculation.")] public TOD_StarsPositionType Position = TOD_StarsPositionType.Rotating; } [Serializable] public class TOD_CloudParameters { [Tooltip("Size of the clouds.")] [TOD_Min(1f)] public float Size = 2f; [Tooltip("Opacity of the clouds.")] [TOD_Range(0f, 1f)] public float Opacity = 1f; [Tooltip("How much sky is covered by clouds.")] [TOD_Range(0f, 1f)] public float Coverage = 0.5f; [Tooltip("Sharpness of the cloud to sky transition.")] [TOD_Range(0f, 1f)] public float Sharpness = 0.5f; [Tooltip("Coloring of the clouds.")] [TOD_Range(0f, 1f)] public float Coloring = 0.5f; [Tooltip("Amount of skylight that is blocked.")] [TOD_Range(0f, 1f)] public float Attenuation = 0.5f; [Tooltip("Amount of sunlight that is blocked.\nOnly affects the highest cloud quality setting.")] [TOD_Range(0f, 1f)] public float Saturation = 0.5f; [Tooltip("Intensity of the cloud translucency glow.\nOnly affects the highest cloud quality setting.")] [TOD_Min(0f)] public float Scattering = 1f; [Tooltip("Brightness of the clouds.")] [TOD_Min(0f)] public float Brightness = 1.5f; } [Serializable] public class TOD_LightParameters { [Tooltip("Refresh interval of the light source position in seconds.")] [TOD_Min(0f)] public float UpdateInterval = 0f; [Tooltip("Controls how low the light source is allowed to go.\n = -1 light source can go as low as it wants.\n = 0 light source will never go below the horizon.\n = +1 light source will never leave zenith.")] [TOD_Range(-1f, 1f)] public float MinimumHeight = 0f; } [Serializable] public class TOD_FogParameters { [Tooltip("Fog color mode.")] public TOD_FogType Mode = TOD_FogType.Atmosphere; [Tooltip("Fog color sampling height.\n = 0 fog is atmosphere color at horizon.\n = 1 fog is atmosphere color at zenith.")] [TOD_Range(0f, 1f)] public float HeightBias = 0f; } [Serializable] public class TOD_AmbientParameters { [Tooltip("Ambient light mode.")] public TOD_AmbientType Mode = TOD_AmbientType.Color; [Tooltip("Saturation of the ambient light.")] [TOD_Min(0f)] public float Saturation = 1f; [Tooltip("Refresh interval of the ambient light probe in seconds.")] [TOD_Min(0f)] public float UpdateInterval = 1f; } [Serializable] public class TOD_ReflectionParameters { [Tooltip("Reflection probe mode.")] public TOD_ReflectionType Mode = TOD_ReflectionType.None; [Tooltip("Clear flags to use for the reflection.")] public ReflectionProbeClearFlags ClearFlags = (ReflectionProbeClearFlags)1; [Tooltip("Layers to include in the reflection.")] public LayerMask CullingMask = LayerMask.op_Implicit(0); [Tooltip("Time slicing behaviour to spread out rendering cost over multiple frames.")] public ReflectionProbeTimeSlicingMode TimeSlicing = (ReflectionProbeTimeSlicingMode)0; [Tooltip("Resolution of the reflection bake.")] [TOD_Range(16f, 2048f)] public int Resolution = 128; [Tooltip("Refresh interval of the reflection cubemap in seconds.")] [TOD_Min(0f)] public float UpdateInterval = 1f; } [ExecuteInEditMode] [RequireComponent(typeof(Camera))] [AddComponentMenu("Time of Day/Camera God Rays")] public class TOD_Rays : TOD_ImageEffect { public enum BlendModeType { Screen, Add } public Shader GodRayShader = null; public Shader ScreenClearShader = null; public Shader SkyMaskShader = null; [Tooltip("Whether or not to use the depth buffer.")] public bool UseDepthTexture = true; [Header("Rays")] [Tooltip("The god ray rendering blend mode.")] public BlendModeType BlendMode = BlendModeType.Screen; [Tooltip("The intensity of the god rays.")] [TOD_Min(0f)] public float Intensity = 1f; [Header("Blur")] [Tooltip("The god ray rendering resolution.")] public ResolutionType Resolution = ResolutionType.Normal; [Tooltip("The number of blur iterations to be performed.")] [TOD_Range(0f, 4f)] public int BlurIterations = 2; [Tooltip("The radius to blur filter applied to the god rays.")] [TOD_Min(0f)] public float BlurRadius = 2f; [Tooltip("The maximum radius of the god rays.")] [TOD_Min(0f)] public float MaxRadius = 0.5f; private Material godRayMaterial = null; private Material screenClearMaterial = null; private Material skyMaskMaterial = null; private const int PASS_SCREEN = 0; private const int PASS_ADD = 1; protected void OnEnable() { if (!Object.op_Implicit((Object)(object)GodRayShader)) { GodRayShader = Shader.Find("Hidden/Time of Day/God Rays"); } if (!Object.op_Implicit((Object)(object)ScreenClearShader)) { ScreenClearShader = Shader.Find("Hidden/Time of Day/Screen Clear"); } if (!Object.op_Implicit((Object)(object)SkyMaskShader)) { SkyMaskShader = Shader.Find("Hidden/Time of Day/Sky Mask"); } godRayMaterial = CreateMaterial(GodRayShader); screenClearMaterial = CreateMaterial(ScreenClearShader); skyMaskMaterial = CreateMaterial(SkyMaskShader); } protected void OnDisable() { if (Object.op_Implicit((Object)(object)godRayMaterial)) { Object.DestroyImmediate((Object)(object)godRayMaterial); } if (Object.op_Implicit((Object)(object)screenClearMaterial)) { Object.DestroyImmediate((Object)(object)screenClearMaterial); } if (Object.op_Implicit((Object)(object)skyMaskMaterial)) { Object.DestroyImmediate((Object)(object)skyMaskMaterial); } } protected void OnRenderImage(RenderTexture source, RenderTexture destination) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (!CheckSupport(UseDepthTexture)) { Graphics.Blit((Texture)(object)source, destination); return; } sky.Components.Rays = this; Vector3 lightPos = cam.WorldToViewportPoint(sky.Components.LightTransform.position); RenderTexture skyMask = GetSkyMask(source, skyMaskMaterial, screenClearMaterial, Resolution, lightPos, BlurIterations, BlurRadius, MaxRadius); Color val = Color.black; if ((double)lightPos.z >= 0.0) { val = ((!sky.IsDay) ? (Intensity * sky.MoonVisibility * sky.MoonRayColor) : (Intensity * sky.SunVisibility * sky.SunRayColor)); } godRayMaterial.SetColor("_LightColor", val); godRayMaterial.SetTexture("_SkyMask", (Texture)(object)skyMask); if (BlendMode == BlendModeType.Screen) { Graphics.Blit((Texture)(object)source, destination, godRayMaterial, 0); } else { Graphics.Blit((Texture)(object)source, destination, godRayMaterial, 1); } RenderTexture.ReleaseTemporary(skyMask); } } public class TOD_Resources : MonoBehaviour { public Material Skybox; public Mesh MoonLOD0; public Mesh MoonLOD1; public Mesh MoonLOD2; public Mesh SkyLOD0; public Mesh SkyLOD1; public Mesh SkyLOD2; public Mesh CloudsLOD0; public Mesh CloudsLOD1; public Mesh CloudsLOD2; public Mesh StarsLOD0; public Mesh StarsLOD1; public Mesh StarsLOD2; public int ID_SunLightColor { get; private set; } public int ID_MoonLightColor { get; private set; } public int ID_SunSkyColor { get; private set; } public int ID_MoonSkyColor { get; private set; } public int ID_SunMeshColor { get; private set; } public int ID_MoonMeshColor { get; private set; } public int ID_SunCloudColor { get; private set; } public int ID_MoonCloudColor { get; private set; } public int ID_FogColor { get; private set; } public int ID_GroundColor { get; private set; } public int ID_AmbientColor { get; private set; } public int ID_SunDirection { get; private set; } public int ID_MoonDirection { get; private set; } public int ID_LightDirection { get; private set; } public int ID_LocalSunDirection { get; private set; } public int ID_LocalMoonDirection { get; private set; } public int ID_LocalLightDirection { get; private set; } public int ID_Contrast { get; private set; } public int ID_Brightness { get; private set; } public int ID_Fogginess { get; private set; } public int ID_Directionality { get; private set; } public int ID_MoonHaloPower { get; private set; } public int ID_MoonHaloColor { get; private set; } public int ID_CloudSize { get; private set; } public int ID_CloudOpacity { get; private set; } public int ID_CloudCoverage { get; private set; } public int ID_CloudSharpness { get; private set; } public int ID_CloudDensity { get; private set; } public int ID_CloudColoring { get; private set; } public int ID_CloudAttenuation { get; private set; } public int ID_CloudSaturation { get; private set; } public int ID_CloudScattering { get; private set; } public int ID_CloudBrightness { get; private set; } public int ID_CloudMultiplier { get; private set; } public int ID_CloudOffset { get; private set; } public int ID_CloudWind { get; private set; } public int ID_StarSize { get; private set; } public int ID_StarBrightness { get; private set; } public int ID_StarVisibility { get; private set; } public int ID_SunMeshContrast { get; private set; } public int ID_SunMeshBrightness { get; private set; } public int ID_MoonMeshContrast { get; private set; } public int ID_MoonMeshBrightness { get; private set; } public int ID_kBetaMie { get; private set; } public int ID_kSun { get; private set; } public int ID_k4PI { get; private set; } public int ID_kRadius { get; private set; } public int ID_kScale { get; private set; } public int ID_World2Sky { get; private set; } public int ID_Sky2World { get; private set; } public void Initialize() { ID_SunLightColor = Shader.PropertyToID("TOD_SunLightColor"); ID_MoonLightColor = Shader.PropertyToID("TOD_MoonLightColor"); ID_SunSkyColor = Shader.PropertyToID("TOD_SunSkyColor"); ID_MoonSkyColor = Shader.PropertyToID("TOD_MoonSkyColor"); ID_SunMeshColor = Shader.PropertyToID("TOD_SunMeshColor"); ID_MoonMeshColor = Shader.PropertyToID("TOD_MoonMeshColor"); ID_SunCloudColor = Shader.PropertyToID("TOD_SunCloudColor"); ID_MoonCloudColor = Shader.PropertyToID("TOD_MoonCloudColor"); ID_FogColor = Shader.PropertyToID("TOD_FogColor"); ID_GroundColor = Shader.PropertyToID("TOD_GroundColor"); ID_AmbientColor = Shader.PropertyToID("TOD_AmbientColor"); ID_SunDirection = Shader.PropertyToID("TOD_SunDirection"); ID_MoonDirection = Shader.PropertyToID("TOD_MoonDirection"); ID_LightDirection = Shader.PropertyToID("TOD_LightDirection"); ID_LocalSunDirection = Shader.PropertyToID("TOD_LocalSunDirection"); ID_LocalMoonDirection = Shader.PropertyToID("TOD_LocalMoonDirection"); ID_LocalLightDirection = Shader.PropertyToID("TOD_LocalLightDirection"); ID_Contrast = Shader.PropertyToID("TOD_Contrast"); ID_Brightness = Shader.PropertyToID("TOD_Brightness"); ID_Fogginess = Shader.PropertyToID("TOD_Fogginess"); ID_Directionality = Shader.PropertyToID("TOD_Directionality"); ID_MoonHaloPower = Shader.PropertyToID("TOD_MoonHaloPower"); ID_MoonHaloColor = Shader.PropertyToID("TOD_MoonHaloColor"); ID_CloudSize = Shader.PropertyToID("TOD_CloudSize"); ID_CloudOpacity = Shader.PropertyToID("TOD_CloudOpacity"); ID_CloudCoverage = Shader.PropertyToID("TOD_CloudCoverage"); ID_CloudSharpness = Shader.PropertyToID("TOD_CloudSharpness"); ID_CloudDensity = Shader.PropertyToID("TOD_CloudDensity"); ID_CloudColoring = Shader.PropertyToID("TOD_CloudColoring"); ID_CloudAttenuation = Shader.PropertyToID("TOD_CloudAttenuation"); ID_CloudSaturation = Shader.PropertyToID("TOD_CloudSaturation"); ID_CloudScattering = Shader.PropertyToID("TOD_CloudScattering"); ID_CloudBrightness = Shader.PropertyToID("TOD_CloudBrightness"); ID_CloudOffset = Shader.PropertyToID("TOD_CloudOffset"); ID_CloudWind = Shader.PropertyToID("TOD_CloudWind"); ID_StarSize = Shader.PropertyToID("TOD_StarSize"); ID_StarBrightness = Shader.PropertyToID("TOD_StarBrightness"); ID_StarVisibility = Shader.PropertyToID("TOD_StarVisibility"); ID_SunMeshContrast = Shader.PropertyToID("TOD_SunMeshContrast"); ID_SunMeshBrightness = Shader.PropertyToID("TOD_SunMeshBrightness"); ID_MoonMeshContrast = Shader.PropertyToID("TOD_MoonMeshContrast"); ID_MoonMeshBrightness = Shader.PropertyToID("TOD_MoonMeshBrightness"); ID_kBetaMie = Shader.PropertyToID("TOD_kBetaMie"); ID_kSun = Shader.PropertyToID("TOD_kSun"); ID_k4PI = Shader.PropertyToID("TOD_k4PI"); ID_kRadius = Shader.PropertyToID("TOD_kRadius"); ID_kScale = Shader.PropertyToID("TOD_kScale"); ID_World2Sky = Shader.PropertyToID("TOD_World2Sky"); ID_Sky2World = Shader.PropertyToID("TOD_Sky2World"); } } [ExecuteInEditMode] [RequireComponent(typeof(Camera))] [AddComponentMenu("Time of Day/Camera Atmospheric Scattering")] public class TOD_Scattering : TOD_ImageEffect { public Shader ScatteringShader = null; public Shader ScreenClearShader = null; public Shader SkyMaskShader = null; public Texture2D DitheringTexture = null; [Tooltip("Whether to render atmosphere and fog in a single pass or two separate passes. Disable when using anti-aliasing in forward rendering or when your manual reflection scripts need the sky dome to be present before the image effects are rendered.")] public bool SinglePass = true; [Header("Fog")] [Tooltip("How quickly the fog thickens with increasing distance.")] [Range(0f, 1f)] public float GlobalDensity = 0.01f; [Tooltip("How quickly the fog falls off with increasing altitude.")] [Range(0f, 1f)] public float HeightFalloff = 0.01f; [Tooltip("The distance the fog starts at.")] public float StartDistance = 0f; [Tooltip("The height where the fog reaches its maximum density.")] public float ZeroLevel = 0f; [Header("Blur")] [Tooltip("The scattering resolution.")] public ResolutionType Resolution = ResolutionType.Normal; [Tooltip("The number of blur iterations to be performed.")] [TOD_Range(0f, 4f)] public int BlurIterations = 2; [Tooltip("The radius to blur filter applied to the directional scattering.")] [TOD_Min(0f)] public float BlurRadius = 2f; [Tooltip("The maximum radius of the directional scattering.")] [TOD_Min(0f)] public float MaxRadius = 1f; private Material scatteringMaterial = null; private Material screenClearMaterial = null; private Material skyMaskMaterial = null; protected void OnEnable() { if (!Object.op_Implicit((Object)(object)ScatteringShader)) { ScatteringShader = Shader.Find("Hidden/Time of Day/Scattering"); } if (!Object.op_Implicit((Object)(object)ScreenClearShader)) { ScreenClearShader = Shader.Find("Hidden/Time of Day/Screen Clear"); } if (!Object.op_Implicit((Object)(object)SkyMaskShader)) { SkyMaskShader = Shader.Find("Hidden/Time of Day/Sky Mask"); } scatteringMaterial = CreateMaterial(ScatteringShader); screenClearMaterial = CreateMaterial(ScreenClearShader); skyMaskMaterial = CreateMaterial(SkyMaskShader); } protected void OnDisable() { if (Object.op_Implicit((Object)(object)scatteringMaterial)) { Object.DestroyImmediate((Object)(object)scatteringMaterial); } if (Object.op_Implicit((Object)(object)screenClearMaterial)) { Object.DestroyImmediate((Object)(object)screenClearMaterial); } if (Object.op_Implicit((Object)(object)skyMaskMaterial)) { Object.DestroyImmediate((Object)(object)skyMaskMaterial); } } protected void OnPreCull() { if (SinglePass && Object.op_Implicit((Object)(object)sky) && sky.Initialized) { sky.Components.AtmosphereRenderer.enabled = false; } } protected void OnPostRender() { if (SinglePass && Object.op_Implicit((Object)(object)sky) && sky.Initialized) { sky.Components.AtmosphereRenderer.enabled = true; } } [ImageEffectOpaque] protected void OnRenderImage(RenderTexture source, RenderTexture destination) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (!CheckSupport(needDepth: true)) { Graphics.Blit((Texture)(object)source, destination); return; } sky.Components.Scattering = this; Vector3 lightPos = cam.WorldToViewportPoint(sky.Components.SunTransform.position); RenderTexture skyMask = GetSkyMask(source, skyMaskMaterial, screenClearMaterial, Resolution, lightPos, BlurIterations, BlurRadius, MaxRadius); scatteringMaterial.SetMatrix("_FrustumCornersWS", FrustumCorners()); scatteringMaterial.SetTexture("_SkyMask", (Texture)(object)skyMask); if (SinglePass) { scatteringMaterial.EnableKeyword("TOD_SCATTERING_SINGLE_PASS"); } else { scatteringMaterial.DisableKeyword("TOD_SCATTERING_SINGLE_PASS"); } Shader.SetGlobalTexture("TOD_BayerTexture", (Texture)(object)DitheringTexture); Shader.SetGlobalVector("TOD_ScatterDensity", new Vector4(HeightFalloff, ZeroLevel, GlobalDensity, StartDistance)); Graphics.Blit((Texture)(object)source, destination, scatteringMaterial); RenderTexture.ReleaseTemporary(skyMask); } } [ExecuteInEditMode] [RequireComponent(typeof(Camera))] [AddComponentMenu("Time of Day/Camera Cloud Shadows")] public class TOD_Shadows : TOD_ImageEffect { public Shader ShadowShader = null; public Texture2D CloudTexture = null; [Header("Shadows")] [Range(0f, 1f)] public float Cutoff = 0f; [Range(0f, 1f)] public float Fade = 0f; [Range(0f, 1f)] public float Intensity = 0.5f; private Material shadowMaterial = null; protected void OnEnable() { if (!Object.op_Implicit((Object)(object)ShadowShader)) { ShadowShader = Shader.Find("Hidden/Time of Day/Cloud Shadows"); } shadowMaterial = CreateMaterial(ShadowShader); } protected void OnDisable() { if (Object.op_Implicit((Object)(object)shadowMaterial)) { Object.DestroyImmediate((Object)(object)shadowMaterial); } } [ImageEffectOpaque] protected void OnRenderImage(RenderTexture source, RenderTexture destination) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (!CheckSupport(needDepth: true)) { Graphics.Blit((Texture)(object)source, destination); return; } sky.Components.Shadows = this; shadowMaterial.SetMatrix("_FrustumCornersWS", FrustumCorners()); Shader.SetGlobalTexture("TOD_CloudTexture", (Texture)(object)CloudTexture); Shader.SetGlobalFloat("TOD_CloudShadowCutoff", Cutoff); Shader.SetGlobalFloat("TOD_CloudShadowFade", Fade); Shader.SetGlobalFloat("TOD_CloudShadowIntensity", Intensity * Mathf.Clamp01(1f - sky.SunZenith / 90f)); Graphics.Blit((Texture)(object)source, destination, shadowMaterial); } } [ExecuteInEditMode] [RequireComponent(typeof(TOD_Resources))] [RequireComponent(typeof(TOD_Components))] public class TOD_Sky : MonoBehaviour { private static List<TOD_Sky> instances = new List<TOD_Sky>(); private int probeRenderID = -1; [Tooltip("Auto: Use the player settings.\nLinear: Force linear color space.\nGamma: Force gamma color space.")] public TOD_ColorSpaceType ColorSpace = TOD_ColorSpaceType.Auto; [Tooltip("Auto: Use the camera settings.\nHDR: Force high dynamic range.\nLDR: Force low dynamic range.")] public TOD_ColorRangeType ColorRange = TOD_ColorRangeType.Auto; [Tooltip("Raw: Write color without modifications.\nDithered: Add dithering to reduce banding.")] public TOD_ColorOutputType ColorOutput = TOD_ColorOutputType.Dithered; [Tooltip("Per Vertex: Calculate sky color per vertex.\nPer Pixel: Calculate sky color per pixel.")] public TOD_SkyQualityType SkyQuality = TOD_SkyQualityType.PerVertex; [Tooltip("Low: Only recommended for very old mobile devices.\nMedium: Simplified cloud shading.\nHigh: Physically based cloud shading.")] public TOD_CloudQualityType CloudQuality = TOD_CloudQualityType.High; [Tooltip("Low: Only recommended for very old mobile devices.\nMedium: Simplified mesh geometry.\nHigh: Detailed mesh geometry.")] public TOD_MeshQualityType MeshQuality = TOD_MeshQualityType.High; [Tooltip("Low: Recommended for most mobile devices.\nMedium: Includes most visible stars.\nHigh: Includes all visible stars.")] public TOD_StarQualityType StarQuality = TOD_StarQualityType.High; public TOD_CycleParameters Cycle; public TOD_WorldParameters World; public TOD_AtmosphereParameters Atmosphere; public TOD_DayParameters Day; public TOD_NightParameters Night; public TOD_SunParameters Sun; public TOD_MoonParameters Moon; public TOD_StarParameters Stars; public TOD_CloudParameters Clouds; public TOD_LightParameters Light; public TOD_FogParameters Fog; public TOD_AmbientParameters Ambient; public TOD_ReflectionParameters Reflection; private float timeSinceLightUpdate = float.MaxValue; private float timeSinceAmbientUpdate = float.MaxValue; private float timeSinceReflectionUpdate = float.MaxValue; private const int TOD_SAMPLES = 2; private Vector3 kBetaMie; private Vector4 kSun; private Vector4 k4PI; private Vector4 kRadius; private Vector4 kScale; private const float pi = (float)Math.PI; private const float tau = (float)Math.PI * 2f; public static List<TOD_Sky> Instances => instances; public static TOD_Sky Instance => (instances.Count != 0) ? instances[instances.Count - 1] : null; public bool Initialized { get; private set; } public bool Headless => false; public TOD_Components Components { get; private set; } public TOD_Resources Resources { get; private set; } public bool IsDay { get; private set; } public bool IsNight { get; private set; } public float Radius => Components.DomeTransform.lossyScale.y; public float Diameter => Components.DomeTransform.lossyScale.y * 2f; public float LerpValue { get; private set; } public float SunZenith { get; private set; } public float SunAltitude { get; private set; } public float SunAzimuth { get; private set; } public float MoonZenith { get; private set; } public float MoonAltitude { get; private set; } public float MoonAzimuth { get; private set; } public float SunsetTime { get; private set; } public float SunriseTime { get; private set; } public float LocalSiderealTime { get; private set; } public float LightZenith => Mathf.Min(SunZenith, MoonZenith); public float LightIntensity => Components.LightSource.intensity; public float SunVisibility { get; private set; } public float MoonVisibility { get; private set; } public Vector3 SunDirection { get; private set; } public Vector3 MoonDirection { get; private set; } public Vector3 LightDirection { get; private set; } public Vector3 LocalSunDirection { get; private set; } public Vector3 LocalMoonDirection { get; private set; } public Vector3 LocalLightDirection { get; private set; } public Color SunLightColor { get; private set; } public Color MoonLightColor { get; private set; } public Color LightColor => Components.LightSource.color; public Color SunRayColor { get; private set; } public Color MoonRayColor { get; private set; } public Color SunSkyColor { get; private set; } public Color MoonSkyColor { get; private set; } public Color SunMeshColor { get; private set; } public Color MoonMeshColor { get; private set; } public Color SunCloudColor { get; private set; } public Color MoonCloudColor { get; private set; } public Color FogColor { get; private set; } public Color GroundColor { get; private set; } public Color AmbientColor { get; private set; } public Color MoonHaloColor { get; private set; } public ReflectionProbe Probe { get; private set; } public Vector3 OrbitalToUnity(float radius, float theta, float phi) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(theta); float num2 = Mathf.Cos(theta); float num3 = Mathf.Sin(phi); float num4 = Mathf.Cos(phi); Vector3 result = default(Vector3); result.z = radius * num * num4; result.y = radius * num2; result.x = radius * num * num3; return result; } public Vector3 OrbitalToLocal(float theta, float phi) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(theta); float y = Mathf.Cos(theta); float num2 = Mathf.Sin(phi); float num3 = Mathf.Cos(phi); Vector3 result = default(Vector3); result.z = num * num3; result.y = y; result.x = num * num2; return result; } public Color SampleAtmosphere(Vector3 direction, bool directLight = true) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Vector3 dir = Components.DomeTransform.InverseTransformDirection(direction); Color color = ShaderScatteringColor(dir, directLight); color = TOD_HDR2LDR(color); return TOD_LINEAR2GAMMA(color); } public SphericalHarmonicsL2 RenderToSphericalHarmonics() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) float saturation = Ambient.Saturation; float intensity = Mathf.Lerp(Night.AmbientMultiplier, Day.AmbientMultiplier, LerpValue); return RenderToSphericalHarmonics(intensity, saturation); } public SphericalHarmonicsL2 RenderToSphericalHarmonics(float intensity, float saturation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) SphericalHarmonicsL2 result = default(SphericalHarmonicsL2); bool directLight = false; Color ambientColor = AmbientColor; Color val = TOD_Util.AdjustRGB(((Color)(ref ambientColor)).linear, intensity, saturation); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.61237246f, 0.5f, 0.61237246f); Vector3 up = Vector3.up; Color val3 = SampleAtmosphere(up, directLight); Color linear = ((Color)(ref val3)).linear; Color val4 = TOD_Util.AdjustRGB(linear, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(up, val4, 0.42857143f); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(0f - val2.x, val2.y, 0f - val2.z); Color val6 = SampleAtmosphere(val5, directLight); Color linear2 = ((Color)(ref val6)).linear; Color val7 = TOD_Util.AdjustRGB(linear2, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val5, val7, 0.2857143f); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(val2.x, val2.y, 0f - val2.z); Color val9 = SampleAtmosphere(val8, directLight); Color linear3 = ((Color)(ref val9)).linear; Color val10 = TOD_Util.AdjustRGB(linear3, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val8, val10, 0.2857143f); Vector3 val11 = default(Vector3); ((Vector3)(ref val11))..ctor(0f - val2.x, val2.y, val2.z); Color val12 = SampleAtmosphere(val11, directLight); Color linear4 = ((Color)(ref val12)).linear; Color val13 = TOD_Util.AdjustRGB(linear4, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val11, val13, 0.2857143f); Vector3 val14 = default(Vector3); ((Vector3)(ref val14))..ctor(val2.x, val2.y, val2.z); Color val15 = SampleAtmosphere(val14, directLight); Color linear5 = ((Color)(ref val15)).linear; Color val16 = TOD_Util.AdjustRGB(linear5, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val14, val16, 0.2857143f); Vector3 left = Vector3.left; Color val17 = SampleAtmosphere(left, directLight); Color linear6 = ((Color)(ref val17)).linear; Color val18 = TOD_Util.AdjustRGB(linear6, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(left, val18, 1f / 7f); Vector3 right = Vector3.right; Color val19 = SampleAtmosphere(right, directLight); Color linear7 = ((Color)(ref val19)).linear; Color val20 = TOD_Util.AdjustRGB(linear7, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(right, val20, 1f / 7f); Vector3 back = Vector3.back; Color val21 = SampleAtmosphere(back, directLight); Color linear8 = ((Color)(ref val21)).linear; Color val22 = TOD_Util.AdjustRGB(linear8, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(back, val22, 1f / 7f); Vector3 forward = Vector3.forward; Color val23 = SampleAtmosphere(forward, directLight); Color linear9 = ((Color)(ref val23)).linear; Color val24 = TOD_Util.AdjustRGB(linear9, intensity, saturation); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(forward, val24, 1f / 7f); Vector3 val25 = default(Vector3); ((Vector3)(ref val25))..ctor(0f - val2.x, 0f - val2.y, 0f - val2.z); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val25, val, 0.2857143f); Vector3 val26 = default(Vector3); ((Vector3)(ref val26))..ctor(val2.x, 0f - val2.y, 0f - val2.z); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val26, val, 0.2857143f); Vector3 val27 = default(Vector3); ((Vector3)(ref val27))..ctor(0f - val2.x, 0f - val2.y, val2.z); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val27, val, 0.2857143f); Vector3 val28 = default(Vector3); ((Vector3)(ref val28))..ctor(val2.x, 0f - val2.y, val2.z); ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(val28, val, 0.2857143f); Vector3 down = Vector3.down; ((SphericalHarmonicsL2)(ref result)).AddDirectionalLight(down, val, 0.42857143f); return result; } public void RenderToCubemap(RenderTexture targetTexture = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Probe)) { Probe = new GameObject().AddComponent<ReflectionProbe>(); ((Object)Probe).name = ((Object)((Component)this).gameObject).name + " Reflection Probe"; Probe.mode = (ReflectionProbeMode)1; } if (probeRenderID < 0 || Probe.IsFinishedRendering(probeRenderID)) { float num = float.MaxValue; ((Component)Probe).transform.position = Components.DomeTransform.position; Probe.size = new Vector3(num, num, num); Probe.intensity = RenderSettings.reflectionIntensity; Probe.clearFlags = Reflection.ClearFlags; Probe.cullingMask = LayerMask.op_Implicit(Reflection.CullingMask); Probe.refreshMode = (ReflectionProbeRefreshMode)2; Probe.timeSlicingMode = Reflection.TimeSlicing; Probe.resolution = Mathf.ClosestPowerOfTwo(Reflection.Resolution); if ((Object)(object)Components.Camera != (Object)null) { Probe.backgroundColor = Components.Camera.BackgroundColor; Probe.nearClipPlane = Components.Camera.NearClipPlane; Probe.farClipPlane = Components.Camera.FarClipPlane; } probeRenderID = Probe.RenderProbe(targetTexture); } } public Color SampleFogColor(bool directLight = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.forward; if ((Object)(object)Components.Camera != (Object)null) { Quaternion rotation = ((Component)Components.Camera).transform.rotation; val = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f) * val; } Vector3 val2 = Vector3.Lerp(val, Vector3.up, Fog.HeightBias); Color val3 = SampleAtmosphere(((Vector3)(ref val2)).normalized, directLight); return new Color(val3.r, val3.g, val3.b, 1f); } public Color SampleSkyColor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Vector3 sunDirection = SunDirection; sunDirection.y = Mathf.Abs(sunDirection.y); Color val = SampleAtmosphere(((Vector3)(ref sunDirection)).normalized, directLight: false); return new Color(val.r, val.g, val.b, 1f); } public Color SampleEquatorColor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Vector3 sunDirection = SunDirection; sunDirection.y = 0f; Color val = SampleAtmosphere(((Vector3)(ref sunDirection)).normalized, directLight: false); return new Color(val.r, val.g, val.b, 1f); } public void UpdateFog() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) switch (Fog.Mode) { case TOD_FogType.None: break; case TOD_FogType.Atmosphere: { Color val = SampleFogColor(directLight: false); if (RenderSettings.fogColor != val) { RenderSettings.fogColor = val; } break; } case TOD_FogType.Directional: { Color val2 = SampleFogColor(); if (RenderSettings.fogColor != val2) { RenderSettings.fogColor = val2; } break; } case TOD_FogType.Gradient: if (RenderSettings.fogColor != FogColor) { RenderSettings.fogColor = FogColor; } break; } } public void UpdateAmbient() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) float saturation = Ambient.Saturation; float num = Mathf.Lerp(Night.AmbientMultiplier, Day.AmbientMultiplier, LerpValue); switch (Ambient.Mode) { case TOD_AmbientType.Color: { Color val2 = TOD_Util.AdjustRGB(AmbientColor, num, saturation); if ((int)RenderSettings.ambientMode != 3) { RenderSettings.ambientMode = (AmbientMode)3; } if (RenderSettings.ambientLight != val2) { RenderSettings.ambientLight = val2; } if (RenderSettings.ambientIntensity != num) { RenderSettings.ambientIntensity = num; } break; } case TOD_AmbientType.Gradient: { Color val3 = TOD_Util.AdjustRGB(AmbientColor, num, saturation); Color val4 = TOD_Util.AdjustRGB(SampleEquatorColor(), num, saturation); Color val5 = TOD_Util.AdjustRGB(SampleSkyColor(), num, saturation); if ((int)RenderSettings.ambientMode != 1) { RenderSettings.ambientMode = (AmbientMode)1; } if (RenderSettings.ambientSkyColor != val5) { RenderSettings.ambientSkyColor = val5; } if (RenderSettings.ambientEquatorColor != val4) { RenderSettings.ambientEquatorColor = val4; } if (RenderSettings.ambientGroundColor != val3) { RenderSettings.ambientGroundColor = val3; } if (RenderSettings.ambientIntensity != num) { RenderSettings.ambientIntensity = num; } break; } case TOD_AmbientType.Spherical: { Color val = TOD_Util.AdjustRGB(AmbientColor, num, saturation); if ((int)RenderSettings.ambientMode != 0) { RenderSettings.ambientMode = (AmbientMode)0; } if (RenderSettings.ambientLight != val) { RenderSettings.ambientLight = val; } if (RenderSettings.ambientIntensity != num) { RenderSettings.ambientIntensity = num; } RenderSettings.ambientProbe = RenderToSphericalHarmonics(num, saturation); break; } } } public void UpdateReflection() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) TOD_ReflectionType mode = Reflection.Mode; if (mode == TOD_ReflectionType.Cubemap) { float num = Mathf.Lerp(Night.ReflectionMultiplier, Day.ReflectionMultiplier, LerpValue); if ((int)RenderSettings.defaultReflectionMode != 0) { RenderSettings.defaultReflectionMode = (DefaultReflectionMode)0; } if (RenderSettings.reflectionIntensity != num) { RenderSettings.reflectionIntensity = num; } if (Application.isPlaying) { RenderToCubemap(); } } } public void LoadParameters(string xml) { using StringReader input = new StringReader(xml); using XmlTextReader xmlReader = new XmlTextReader(input); XmlSerializer xmlSerializer = new XmlSerializer(typeof(TOD_Parameters)); TOD_Parameters tOD_Parameters = xmlSerializer.Deserialize(xmlReader) as TOD_Parameters; tOD_Parameters.ToSky(this); } public string SaveParameters() { StringBuilder stringBuilder = new StringBuilder(); using (StringWriter w = new StringWriter(stringBuilder)) { using XmlTextWriter xmlTextWriter = new XmlTextWriter(w); xmlTextWriter.Formatting = Formatting.Indented; XmlSerializer xmlSerializer = new XmlSerializer(typeof(TOD_Parameters)); TOD_Parameters o = new TOD_Parameters(this); xmlSerializer.Serialize(xmlTextWriter, o); } return stringBuilder.ToString(); } private void UpdateQualitySettings() { if (!Headless) { Mesh val = null; Mesh val2 = null; Mesh val3 = null; Mesh val4 = null; Mesh val5 = null; Mesh val6 = null; switch (MeshQuality) { case TOD_MeshQualityType.Low: val = Resources.SkyLOD2; val2 = Resources.SkyLOD2; val3 = Resources.SkyLOD2; val4 = Resources.CloudsLOD2; val5 = Resources.MoonLOD2; break; case TOD_MeshQualityType.Medium: val = Resources.SkyLOD1; val2 = Resources.SkyLOD1; val3 = Resources.SkyLOD2; val4 = Resources.CloudsLOD1; val5 = Resources.MoonLOD1; break; case TOD_MeshQualityType.High: val = Resources.SkyLOD0; val2 = Resources.SkyLOD0; val3 = Resources.SkyLOD2; val4 = Resources.CloudsLOD0; val5 = Resources.MoonLOD0; break; } switch (StarQuality) { case TOD_StarQualityType.Low: val6 = Resources.StarsLOD2; break; case TOD_StarQualityType.Medium: val6 = Resources.StarsLOD1; break; case TOD_StarQualityType.High: val6 = Resources.StarsLOD0; break; } if (Object.op_Implicit((Object)(object)Components.SpaceMeshFilter) && (Object)(object)Components.SpaceMeshFilter.sharedMesh != (Object)(object)val) { Components.SpaceMeshFilter.mesh = val; } if (Object.op_Implicit((Object)(object)Components.MoonMeshFilter) && (Object)(object)Components.MoonMeshFilter.sharedMesh != (Object)(object)val5) { Components.MoonMeshFilter.mesh = val5; } if (Object.op_Implicit((Object)(object)Components.AtmosphereMeshFilter) && (Object)(object)Components.AtmosphereMeshFilter.sharedMesh != (Object)(object)val2) { Components.AtmosphereMeshFilter.mesh = val2; } if (Object.op_Implicit((Object)(object)Components.ClearMeshFilter) && (Object)(object)Components.ClearMeshFilter.sharedMesh != (Object)(object)val3) { Components.ClearMeshFilter.mesh = val3; } if (Object.op_Implicit((Object)(object)Components.CloudMeshFilter) && (Object)(object)Components.CloudMeshFilter.sharedMesh != (Object)(object)val4) { Components.CloudMeshFilter.mesh = val4; } if (Object.op_Implicit((Object)(object)Components.StarMeshFilter) && (Object)(object)Components.StarMeshFilter.sharedMesh != (Object)(object)val6) { Components.StarMeshFilter.mesh = val6; } } } private void UpdateRenderSettings() { if (!Headless) { UpdateFog(); if (!Application.isPlaying || timeSinceAmbientUpdate >= Ambient.UpdateInterval) { timeSinceAmbientUpdate = 0f; UpdateAmbient(); } else { timeSinceAmbientUpdate += Time.deltaTime; } if (!Application.isPlaying || timeSinceReflectionUpdate >= Reflection.UpdateInterval) { timeSinceReflectionUpdate = 0f; UpdateReflection(); } else { timeSinceReflectionUpdate += Time.deltaTime; } } } private void UpdateShaderKeywords() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if (Headless) { return; } switch (ColorSpace) { case TOD_ColorSpaceType.Auto: if ((int)QualitySettings.activeColorSpace == 1) { Shader.EnableKeyword("TOD_OUTPUT_LINEAR"); } else { Shader.DisableKeyword("TOD_OUTPUT_LINEAR"); } break; case TOD_ColorSpaceType.Linear: Shader.EnableKeyword("TOD_OUTPUT_LINEAR"); break; case TOD_ColorSpaceType.Gamma: Shader.DisableKeyword("TOD_OUTPUT_LINEAR"); break; } switch (ColorRange) { case TOD_ColorRangeType.Auto: if (Object.op_Implicit((Object)(object)Components.Camera) && Components.Camera.HDR) { Shader.EnableKeyword("TOD_OUTPUT_HDR"); } else { Shader.DisableKeyword("TOD_OUTPUT_HDR"); } break; case TOD_ColorRangeType.HDR: Shader.EnableKeyword("TOD_OUTPUT_HDR"); break; case TOD_ColorRangeType.LDR: Shader.DisableKeyword("TOD_OUTPUT_HDR"); break; } switch (ColorOutput) { case TOD_ColorOutputType.Raw: Shader.DisableKeyword("TOD_OUTPUT_DITHERING"); break; case TOD_ColorOutputType.Dithered: Shader.EnableKeyword("TOD_OUTPUT_DITHERING"); break; } switch (SkyQuality) { case TOD_SkyQualityType.PerVertex: Shader.DisableKeyword("TOD_SCATTERING_PER_PIXEL"); break; case TOD_SkyQualityType.PerPixel: Shader.EnableKeyword("TOD_SCATTERING_PER_PIXEL"); break; } switch (CloudQuality) { case TOD_CloudQualityType.Low: Shader.DisableKeyword("TOD_CLOUDS_DENSITY"); Shader.DisableKeyword("TOD_CLOUDS_BUMPED"); break; case TOD_CloudQualityType.Medium: Shader.EnableKeyword("TOD_CLOUDS_DENSITY"); Shader.DisableKeyword("TOD_CLOUDS_BUMPED"); break; case TOD_CloudQualityType.High: Shader.EnableKeyword("TOD_CLOUDS_DENSITY"); Shader.EnableKeyword("TOD_CLOUDS_BUMPED"); break; } } private void UpdateShaderProperties() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) if (!Headless) { Shader.SetGlobalColor(Resources.ID_SunLightColor, SunLightColor); Shader.SetGlobalColor(Resources.ID_MoonLightColor, MoonLightColor); Shader.SetGlobalColor(Resources.ID_SunSkyColor, SunSkyColor); Shader.SetGlobalColor(Resources.ID_MoonSkyColor, MoonSkyColor); Shader.SetGlobalColor(Resources.ID_SunMeshColor, SunMeshColor); Shader.SetGlobalColor(Resources.ID_MoonMeshColor, MoonMeshColor); Shader.SetGlobalColor(Resources.ID_SunCloudColor, SunCloudColor); Shader.SetGlobalColor(Resources.ID_MoonCloudColor, MoonCloudColor); Shader.SetGlobalColor(Resources.ID_FogColor, FogColor); Shader.SetGlobalColor(Resources.ID_GroundColor, GroundColor); Shader.SetGlobalColor(Resources.ID_AmbientColor, AmbientColor); Shader.SetGlobalVector(Resources.ID_SunDirection, Vector4.op_Implicit(SunDirection)); Shader.SetGlobalVector(Resources.ID_MoonDirection, Vector4.op_Implicit(MoonDirection)); Shader.SetGlobalVector(Resources.ID_LightDirection, Vector4.op_Implicit(LightDirection)); Shader.SetGlobalVector(Resources.ID_LocalSunDirection, Vector4.op_Implicit(LocalSunDirection)); Shader.SetGlobalVector(Resources.ID_LocalMoonDirection, Vector4.op_Implicit(LocalMoonDirection)); Shader.SetGlobalVector(Resources.ID_LocalLightDirection, Vector4.op_Implicit(LocalLightDirection)); Shader.SetGlobalFloat(Resources.ID_Contrast, Atmosphere.Contrast); Shader.SetGlobalFloat(Resources.ID_Brightness, Atmosphere.Brightness); Shader.SetGlobalFloat(Resources.ID_Fogginess, Atmosphere.Fogginess); Shader.SetGlobalFloat(Resources.ID_Directionality, Atmosphere.Directionality); Shader.SetGlobalFloat(Resources.ID_MoonHaloPower, 1f / Moon.HaloSize); Shader.Set