Decompiled source of CullFactory v1.5.0
CullFactory.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using CullFactory.Behaviours.API; using CullFactory.Behaviours.CullingMethods; using CullFactory.Behaviours.Visualization; using CullFactory.Data; using CullFactory.Extenders; using CullFactory.Services; using CullFactoryBurst; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Burst; using Unity.Burst.LowLevel; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: AssemblyCompany("CullFactory")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+39f868ee342c0e7dad556b3bd1a5fa583ab99045")] [assembly: AssemblyProduct("CullFactory")] [assembly: AssemblyTitle("CullFactory")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CullFactory { public static class Config { private const string DungeonFlowListDescription = "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."; private static readonly Version DefaultVersion = new Version(0, 0, 0); private static readonly string VersionFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "version"); private static readonly string[] DefaultFlowsToBlockCulling = Array.Empty<string>(); private static readonly string[] BaseSetOfInteriorsToUseFallbackPortals = new string[3] { "BunkerFlow", "School", "CIDOMFlow" }; private static ConfigEntry<CullingType> Culler; private static ConfigEntry<string> InteriorsToBlockCulling; private static ConfigEntry<string> InteriorsToForceCulling; public static string[] InteriorsWithDisabledCulling = Array.Empty<string>(); public static ConfigEntry<bool> Logging { get; private set; } public static ConfigEntry<float> UpdateFrequency { get; private set; } public static ConfigEntry<bool> DisableShadowDistanceFading { get; private set; } public static ConfigEntry<bool> DisableLODCulling { get; private set; } public static ConfigEntry<string> InteriorsToUseFallbackPortals { get; private set; } public static ConfigEntry<string> InteriorsToSkipFallbackPortals { get; private set; } public static ConfigEntry<int> MaxBranchingDepth { get; private set; } public static ConfigEntry<bool> CullDistanceEnabled { get; private set; } public static ConfigEntry<float> CullDistance { get; private set; } public static ConfigEntry<float> SurfaceCullDistance { get; private set; } public static ConfigEntry<string> OverrideMapSeed { get; private set; } public static ConfigEntry<bool> VisualizePortals { get; private set; } public static ConfigEntry<float> VisualizedPortalOutsetDistance { get; private set; } public static ConfigEntry<bool> VisualizeTileBounds { get; private set; } public static string[] InteriorsWithFallbackPortals { get; private set; } public static void Initialize(ConfigFile configFile) { Culler = configFile.Bind<CullingType>("General", "Culling type", CullingType.PortalOcclusionCulling, "The culling type to use.\n\nOptions:\n\"PortalOcclusionCulling\": Hides all the rooms that aren't visible to the camera (Recommended)\n\"DepthCulling\": Hides rooms that aren't adjacent to the player's current room"); InteriorsToBlockCulling = configFile.Bind<string>("General", "Disable culling for interiors", "", "A list of dungeon flows to disable culling on, separated by commas, i.e.\n\"Level1Flow, Level2Flow\"\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); string text = ((DefaultFlowsToBlockCulling.Length != 0) ? ("This can be used to override the internal blacklist containing " + DefaultFlowsToBlockCulling.HumanReadableList() + ".") : "This will have no effect as the internal blacklist is empty."); InteriorsToForceCulling = configFile.Bind<string>("General", "Force enable culling for interiors", "", "A list of dungeon flows to have culling force-enabled. " + text + "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); UpdateFrequency = configFile.Bind<float>("General", "Update frequency", 0f, "Higher values make culling more responsive at the cost of performance.\nCurrently this has no effect when portal occlusion culling is used.\nUpdate interval: 1 / value (seconds)"); DisableShadowDistanceFading = configFile.Bind<bool>("General", "Disable shadow distance fading", true, "Prevents lights' shadows from being hidden before the light itself becomes invisible.\nFixes issues that are common in Mansion where some lights will be visible through walls, and allows more lights/tiles to be culled within the interior.\nDisabling may have a negative impact on performance."); DisableLODCulling = configFile.Bind<bool>("General", "Disable LOD culling", true, "Forces the last LOD to stay visible for all static objects in the interior. This will prevent the stairs on the factory interior from disappearing at a distance, and should also prevent any other similar disappearing objects.\nObjects that have LOD groups will instead be culled based on visibility, so this has a minimal effect on performance."); InteriorsToUseFallbackPortals = configFile.Bind<string>("Portal occlusion culling", "Use fallback portals for interiors", "", "Uses the maximum possible doorway sizes in each tile for visibility testing in the specified interiors.\nThis is recommended for interiors with incorrect doorway sizes.\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); InteriorsToSkipFallbackPortals = configFile.Bind<string>("Portal occlusion culling", "Skip fallback portals for interiors", "", "Skip using fallback portals on previously problematic interiors:\n" + BaseSetOfInteriorsToUseFallbackPortals.JoinByComma() + "\n\nValue:\nA list of dungeon generators, separated by commas \",\"."); MaxBranchingDepth = configFile.Bind<int>("Depth culling", "Max branching depth", 4, "How many doors can be traversed before a room is culled."); CullDistanceEnabled = configFile.Bind<bool>("Distance culling", "Enabled", false, "Whether to override the camera's far plane distance. When this is false, the 'Cull distance' and 'Surface cull distance' options will have no effect.\nIf performance with portal occlusion culling enabled is insufficient this may provide a small boost in performance."); CullDistance = configFile.Bind<float>("Distance culling", "Cull distance", 40f, "The camera's far plane distance.\nObjects that are this far from the player will be culled.\nVanilla value: 400"); SurfaceCullDistance = configFile.Bind<float>("Distance culling", "Surface cull distance", 200f, "The camera's far plane distance when **on the surface**.\nObjects that are this far from the player will be culled.\nVanilla value: 400"); VisualizePortals = configFile.Bind<bool>("Debug", "Visualize portals", false, "Shows a rectangle representing the bounds of all portals that are used to determine visibility when portal occlusion culling is enabled. If the portal doesn't block the entirety of the visible portion of the next tile, then culling will not be correct."); VisualizedPortalOutsetDistance = configFile.Bind<float>("Debug", "Visualized portal outset distance", 0.2f, "The distance to offset each side of a portal visualizer out from the actual position of the portal. For doors that don't cover an entire tile wall, this allows seeing the exact bounds it covers."); VisualizeTileBounds = configFile.Bind<bool>("Debug", "Visualize tile bounds", false, "Shows a rectangular prism to represent the bounds all tiles. These bounds are used to determine which tile a camera resides in."); OverrideMapSeed = configFile.Bind<string>("Debug", "Override map seed", "", "INTENDED FOR BENCHMARKING ONLY. Leave this empty if you are playing normally.\nThis forces the map seed to be whatever is entered here, so that benchmarking numbers can remain as consistent as possible between runs."); Logging = configFile.Bind<bool>("Debug", "Show culling logs", false, "View culling activity in the console."); MigrateSettings(); Culler.SettingChanged += delegate { CullingMethod.Initialize(); }; InteriorsToBlockCulling.SettingChanged += delegate { UpdateInteriorsWithDisabledCulling(); }; InteriorsToForceCulling.SettingChanged += delegate { UpdateInteriorsWithDisabledCulling(); }; UpdateFrequency.SettingChanged += delegate { CullingMethod.Initialize(); }; DisableShadowDistanceFading.SettingChanged += delegate { RefreshCullingInfoAndMethod(); }; DisableLODCulling.SettingChanged += delegate { RefreshCullingInfoAndMethod(); }; InteriorsToUseFallbackPortals.SettingChanged += delegate { UpdateInteriorsWithFallbackPortals(); }; InteriorsToSkipFallbackPortals.SettingChanged += delegate { UpdateInteriorsWithFallbackPortals(); }; CullDistanceEnabled.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; CullDistance.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; SurfaceCullDistance.SettingChanged += delegate { TeleportExtender.SetInitialFarClipPlane(); }; VisualizePortals.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; VisualizedPortalOutsetDistance.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; VisualizeTileBounds.SettingChanged += delegate { Plugin.CreateCullingVisualizers(); }; UpdateInteriorsWithDisabledCulling(); UpdateInteriorsWithFallbackPortals(); } private static void MigrateSettings() { Version version = (File.Exists(VersionFile) ? Version.Parse(Encoding.UTF8.GetString(File.ReadAllBytes(VersionFile))) : DefaultVersion); if (version <= new Version(0, 8, 0)) { InteriorsToUseFallbackPortals.Value = InteriorsToUseFallbackPortals.Value.SplitByComma().Except(new <>z__ReadOnlyArray<string>(new string[2] { "CastleFlow", "SewerFlow" })).JoinByComma(); } if (version <= new Version(0, 8, 6)) { UpdateFrequency.Value = (float)((ConfigEntryBase)UpdateFrequency).DefaultValue; } using FileStream fileStream = File.Open(VersionFile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); fileStream.Write(Encoding.UTF8.GetBytes("1.5.0")); } private static void UpdateInteriorsWithDisabledCulling() { InteriorsWithDisabledCulling = DefaultFlowsToBlockCulling.Union(InteriorsToBlockCulling.Value.SplitByComma()).Except(InteriorsToForceCulling.Value.SplitByComma()).ToArray(); CullingMethod.Initialize(); } public static CullingType GetCullingType(DungeonFlow dungeonFlow) { if (InteriorsWithDisabledCulling.Contains(((Object)dungeonFlow).name)) { return CullingType.None; } return Culler.Value; } private static void UpdateInteriorsWithFallbackPortals() { InteriorsWithFallbackPortals = BaseSetOfInteriorsToUseFallbackPortals.Union(InteriorsToUseFallbackPortals.Value.SplitByComma()).Except(InteriorsToSkipFallbackPortals.Value.SplitByComma()).ToArray(); RefreshCullingInfoAndMethod(); } private static void RefreshCullingInfoAndMethod() { DungeonCullingInfo.RefreshCullingInfo(); CullingMethod.Initialize(); } } [BepInPlugin("com.fumiko.CullFactory", "CullFactory", "1.5.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.fumiko.CullFactory"; public const string Name = "CullFactory"; public const string Version = "1.5.0"; private Harmony _harmony = new Harmony("com.fumiko.CullFactory"); public static Plugin Instance { get; private set; } private void Awake() { Instance = this; Config.Initialize(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(LevelGenerationExtender)); _harmony.PatchAll(typeof(TeleportExtender)); _harmony.PatchAll(typeof(MapSeedOverride)); _harmony.PatchAll(typeof(GrabbableObjectExtender)); QualitySettings.shadowResolution = (ShadowResolution)0; LoadBurstAssembly(); Log("Plugin CullFactory is loaded!"); } private void LoadBurstAssembly() { string text = Path.Combine(new FileInfo(((BaseUnityPlugin)this).Info.Location).DirectoryName, "lib_burst_generated.data"); if (!File.Exists(text)) { LogError("CullFactory's Burst assembly 'lib_burst_generated.data' was not found, culling may be slower than normal."); return; } if (!BurstRuntime.LoadAdditionalLibrary(text)) { LogError("CullFactory's Burst assembly failed to load, culling may be slower than normal."); return; } if (!Plugin.IsRunningBurstLibrary()) { LogError("CullFactory's Burst plugin is not running its Burst-compiled code, culling may be slower than normal."); return; } LogAlways("Loaded CullFactory's Burst assembly."); _harmony.PatchAll(typeof(BurstErrorPrevention)); } public static void LogAlways(string s) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)s); } public static void Log(string s) { if (Config.Logging.Value) { LogAlways(s); } } public static void LogWarning(string s) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)s); } public static void LogError(string s) { ((BaseUnityPlugin)Instance).Logger.LogError((object)s); } public static void CreateCullingVisualizers() { if (!((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)) { GameObject gameObject = ((Component)RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon).gameObject; Object.DestroyImmediate((Object)(object)gameObject.GetComponent<CullingVisualizer>()); gameObject.AddComponent<CullingVisualizer>().RefreshVisualizers(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "CullFactory"; public const string PLUGIN_NAME = "CullFactory"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CullFactory.Services { public static class BoundsUtility { public static Plane[] GetPlanes(this Bounds bounds) { //IL_0017: 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_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_0044: 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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00db: 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_00f6: 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_0107: 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) return (Plane[])(object)new Plane[6] { new Plane(new Vector3(1f, 0f, 0f), 0f - ((Bounds)(ref bounds)).min.x), new Plane(new Vector3(0f, 1f, 0f), 0f - ((Bounds)(ref bounds)).min.y), new Plane(new Vector3(0f, 0f, 1f), 0f - ((Bounds)(ref bounds)).min.z), new Plane(new Vector3(-1f, 0f, 0f), ((Bounds)(ref bounds)).max.x), new Plane(new Vector3(0f, -1f, 0f), ((Bounds)(ref bounds)).max.y), new Plane(new Vector3(0f, 0f, -1f), ((Bounds)(ref bounds)).max.z) }; } public static void GetFarthestPlanesNonAlloc(this Bounds bounds, Vector3 point, Plane[] planes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_002c: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00bb: 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_008d: 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) //IL_009e: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) planes[0] = ((point.x > ((Bounds)(ref bounds)).center.x) ? new Plane(new Vector3(1f, 0f, 0f), 0f - ((Bounds)(ref bounds)).min.x) : new Plane(new Vector3(-1f, 0f, 0f), ((Bounds)(ref bounds)).max.x)); planes[1] = ((point.y > ((Bounds)(ref bounds)).center.y) ? new Plane(new Vector3(0f, 1f, 0f), 0f - ((Bounds)(ref bounds)).min.y) : new Plane(new Vector3(0f, -1f, 0f), ((Bounds)(ref bounds)).max.y)); planes[2] = ((point.z > ((Bounds)(ref bounds)).center.z) ? new Plane(new Vector3(0f, 0f, 1f), 0f - ((Bounds)(ref bounds)).min.z) : new Plane(new Vector3(0f, 0f, -1f), ((Bounds)(ref bounds)).max.z)); } public static Plane[] GetFarthestPlanes(this Bounds bounds, Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Plane[] array = (Plane[])(object)new Plane[3]; bounds.GetFarthestPlanesNonAlloc(point, array); return array; } public static Vector3[] GetVertices(Vector3 min, Vector3 max) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0044: 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_0050: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0079: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c8: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) return (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z) }; } public static Vector3[] GetVertices(this Bounds bounds) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return GetVertices(((Bounds)(ref bounds)).min, ((Bounds)(ref bounds)).max); } } public class IdentityEqualityComparer<T> : IEqualityComparer<T> { public static readonly IdentityEqualityComparer<T> Instance = new IdentityEqualityComparer<T>(); public bool Equals(T x, T y) { return (object)x == (object)y; } public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); } } public static class LightUtility { public static bool Affects(this Light light, Bounds bounds) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) float range = light.range; if (((Bounds)(ref bounds)).SqrDistance(((Component)light).transform.position) > range * range) { return false; } if ((int)light.type == 0) { return Geometry.SpotLightInfluencesBounds(ref light, ref bounds); } return true; } public static bool Affects(this Light light, TileContents tile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return light.Affects(tile.rendererBounds); } public static bool Affects(this Light light, IEnumerable<TileContents> tiles) { foreach (TileContents tile in tiles) { if (light.Affects(tile)) { return true; } } return false; } public static bool HasShadows(this Light light) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 return (int)light.shadows > 0; } public static bool PassesThroughOccluders(this Light light) { if (light.HasShadows()) { HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>(); if (component != null) { return component.shadowDimmer < 1f; } return false; } return true; } public static void SetVisible(this Light light, bool visible) { if (!((Object)(object)light == (Object)null)) { if (light.cullingMask != -1 && light.cullingMask != 0) { Plugin.LogWarning($"Light {((Object)light).name}'s culling mask was an unexpected value of {light.cullingMask}."); } light.cullingMask = (visible ? (-1) : 0); } } public static void SetVisible(this IEnumerable<Light> lights, bool visible) { foreach (Light light in lights) { light.SetVisible(visible); } } } public static class ObjectContentsUtility { public static void SetSelfVisible(this IEnumerable<TileContents> tiles, bool visible) { foreach (TileContents tile in tiles) { tile.SetSelfVisible(visible); } } public static void SetVisible(this IEnumerable<GrabbableObjectContents> items, bool visible) { foreach (GrabbableObjectContents item in items) { item.SetVisible(visible); } } public static void AddContentsVisibleToCamera(this ICollection<TileContents> result, Camera camera) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (camera.orthographic) { result.AddContentsWithinCameraFrustum(camera); return; } TileContents tileContents = ((Component)camera).transform.position.GetTileContents(); if (tileContents != null) { VisibilityTesting.CallForEachLineOfSight(camera, tileContents, delegate(TileContents[] tiles, Plane[][] frustums, int index) { result.Add(tiles[index]); }); } } public static void AddContentsWithinCameraFrustum(this ICollection<TileContents> result, Camera camera) { Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = DungeonCullingInfo.AllTileContents; foreach (TileContents tileContents in allTileContents) { if (Geometry.TestPlanesAABB(ref array, ref tileContents.bounds)) { result.Add(tileContents); } } } } public static class StringUtility { public static IEnumerable<string> SplitByComma(this string input) { return from name in input.Split(',', StringSplitOptions.RemoveEmptyEntries) select name.Trim().Trim('"'); } public static string JoinByComma(this IEnumerable<string> input) { return string.Join(", ", input); } public static string HumanReadableList(this IEnumerable<string> input) { IEnumerator<string> enumerator = input.GetEnumerator(); if (!enumerator.MoveNext()) { return ""; } StringBuilder stringBuilder = new StringBuilder(enumerator.Current); if (!enumerator.MoveNext()) { return stringBuilder.ToString(); } string current; while (true) { current = enumerator.Current; if (!enumerator.MoveNext()) { break; } stringBuilder.Append(", "); stringBuilder.Append(current); } stringBuilder.Append(", and "); stringBuilder.Append(current); return stringBuilder.ToString(); } } public static class TransformUtility { public static string GetPath(this Transform obj) { StringBuilder stringBuilder = new StringBuilder(((Object)obj).name); Transform parent = obj.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, "/"); stringBuilder.Insert(0, ((Object)parent).name); parent = parent.parent; } return stringBuilder.ToString(); } public static bool TryGetComponentInParent<T>(this Transform transform, out T component) { component = ((Component)transform).GetComponentInParent<T>(); return component != null; } } public static class VisibilityTesting { public delegate void LineOfSightCallback(TileContents[] tileStack, Plane[][] frustumStack, int stackIndex); private const int MaxStackCapacity = 16; private static readonly TileContents[] TileStack = new TileContents[16]; private static readonly int[] IndexStack = new int[16]; private static readonly Plane[][] FrustumStack = new Plane[16][]; private static bool warnedThatStackWasExceeded = false; internal static bool IntersectsFrustums(this Bounds bounds, Plane[][] frustums, int lastFrustum) { for (int i = 0; i <= lastFrustum; i++) { if (!Geometry.TestPlanesAABB(ref frustums[i], ref bounds)) { return false; } } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool AdvanceToNextTile(Vector3 origin, ref int stackIndex) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) TileContents tileContents = TileStack[stackIndex]; int num = IndexStack[stackIndex]++; if (num >= tileContents.portals.Length) { stackIndex--; return false; } Portal portal = tileContents.portals[num]; TileContents nextTile = portal.NextTile; if (nextTile == null) { return false; } if (stackIndex > 0 && nextTile == TileStack[stackIndex - 1]) { return false; } if (!portal.Bounds.IntersectsFrustums(FrustumStack, stackIndex)) { return false; } stackIndex++; if (stackIndex >= 16) { stackIndex--; if (!warnedThatStackWasExceeded) { Plugin.LogWarning($"Exceeded the maximum portal occlusion culling depth of {16}."); warnedThatStackWasExceeded = true; } return false; } TileStack[stackIndex] = nextTile; IndexStack[stackIndex] = 0; if (FrustumStack[stackIndex] == null) { FrustumStack[stackIndex] = portal.GetFrustumPlanes(origin); } else { portal.GetFrustumPlanesNonAlloc(origin, FrustumStack[stackIndex]); } return true; } public static void CallForEachLineOfSight(Vector3 origin, TileContents originTile, Plane[] frustum, LineOfSightCallback callback) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) TileStack[0] = originTile; IndexStack[0] = 0; FrustumStack[0] = frustum; int stackIndex = 0; callback(TileStack, FrustumStack, stackIndex); while (stackIndex >= 0) { if (AdvanceToNextTile(origin, ref stackIndex)) { callback(TileStack, FrustumStack, stackIndex); } } } public static void CallForEachLineOfSight(Camera camera, TileContents originTile, LineOfSightCallback callback) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) CallForEachLineOfSight(((Component)camera).transform.position, originTile, GeometryUtility.CalculateFrustumPlanes(camera), callback); } public static void CallForEachLineOfSight(Vector3 origin, TileContents originTile, LineOfSightCallback callback) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) CallForEachLineOfSight(origin, originTile, Array.Empty<Plane>(), callback); } private static bool FrustumIntersectsAnyTile(Plane[] frustum, HashSet<TileContents> tiles) { foreach (TileContents tile in tiles) { if (Geometry.TestPlanesAABB(ref frustum, ref tile.bounds)) { return true; } } return false; } public static bool CallForEachLineOfSightTowardTiles(Vector3 origin, TileContents originTile, Plane[] frustum, HashSet<TileContents> goalTiles, LineOfSightCallback callback) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) TileStack[0] = originTile; IndexStack[0] = 0; FrustumStack[0] = frustum; int stackIndex = 0; callback(TileStack, FrustumStack, stackIndex); bool result = goalTiles.Contains(originTile); while (stackIndex >= 0) { if (!AdvanceToNextTile(origin, ref stackIndex)) { continue; } if (!FrustumIntersectsAnyTile(FrustumStack[stackIndex], goalTiles)) { stackIndex--; continue; } if (goalTiles.Contains(TileStack[stackIndex])) { result = true; } callback(TileStack, FrustumStack, stackIndex); } return result; } public static bool CallForEachLineOfSightTowardTiles(Vector3 origin, TileContents originTile, HashSet<TileContents> goalTiles, LineOfSightCallback callback) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CallForEachLineOfSightTowardTiles(origin, originTile, Array.Empty<Plane>(), goalTiles, callback); } } } namespace CullFactory.Extenders { internal static class BurstErrorPrevention { [HarmonyTranspiler] [HarmonyPatch(typeof(BurstCompiler), "GetILPPMethodFunctionPointer2")] private static IEnumerable<CodeInstruction> PatchGetILPPMethodFunctionPointer2(IEnumerable<CodeInstruction> instructions) { //IL_0002: 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_0026: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"ilppMethod", (string)null), new CodeMatch((OpCode?)OpCodes.Newobj, (object)typeof(ArgumentNullException).GetConstructor(new Type[1] { typeof(string) }), (string)null), new CodeMatch((OpCode?)OpCodes.Throw, (object)null, (string)null) }); if (val.IsInvalid) { Plugin.LogError("Failed to find Burst function pointer getter's throw statement"); return instructions; } val.RemoveInstructions(3).Insert((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Ret, (object)null) }); return val.Instructions(); } [HarmonyTranspiler] [HarmonyPatch(typeof(BurstCompiler), "Compile", new Type[] { typeof(object), typeof(MethodInfo), typeof(bool), typeof(bool) })] private static IEnumerable<CodeInstruction> PatchCompile(IEnumerable<CodeInstruction> instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); MethodInfo method = typeof(BurstCompilerService).GetMethod("GetAsyncCompiledAsyncDelegateMethod", new Type[1] { typeof(int) }); if (method == null) { Plugin.LogError("Failed to find the Burst async compilation method"); return instructions; } val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Call, (object)method, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null) }).Advance(1); Label? label = default(Label?); if (val.IsInvalid || !CodeInstructionExtensions.Branches(val.Instruction, ref label)) { Plugin.LogAlways($"{val.Instruction}"); Plugin.LogError("Failed to find the call to the Burst async compilation method"); return instructions; } val.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Conv_U, (object)null), new CodeInstruction(OpCodes.Bne_Un, (object)label) }); CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[9] { new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Conv_U, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Bne_Un, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)typeof(string).GetMethod("Format", new Type[2] { typeof(string), typeof(object) }), (string)null), new CodeMatch((OpCode?)OpCodes.Newobj, (object)typeof(InvalidOperationException).GetConstructor(new Type[1] { typeof(string) }), (string)null), new CodeMatch((OpCode?)OpCodes.Throw, (object)null, (string)null) }; val.MatchForward(false, array); if (val.IsInvalid) { Plugin.LogError("Failed to find Burst compilation failure throw statement"); return instructions; } List<Label> labels = val.Instruction.labels; val.RemoveInstructions(array.Length).Labels.AddRange(labels); return val.Instructions(); } } [HarmonyPatch(typeof(GrabbableObject))] internal static class GrabbableObjectExtender { [HarmonyPostfix] [HarmonyPatch("Start")] private static void GrabbableObjectStarted(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("FallToGround")] private static void GrabbableObjectFalling(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("EnablePhysics")] private static void GrabbableObjectDropped(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("EnableItemMeshes")] private static void GrabbableObjectShownOrHidden(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("GrabItemFromEnemy")] private static void GrabbableObjectPickedUpByEnemy(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } [HarmonyPostfix] [HarmonyPatch("DiscardItemFromEnemy")] private static void GrabbableObjectDroppedByEnemy(GrabbableObject __instance) { DynamicObjects.MarkGrabbableObjectDirty(__instance); } } public static class LevelGenerationExtender { [HarmonyPostfix] [HarmonyPatch(typeof(RoundManager), "SetLevelObjectVariables")] private static void OnLevelGenerated() { DungeonCullingInfo.OnLevelGenerated(); CullingMethod.Initialize(); Plugin.CreateCullingVisualizers(); DynamicObjects.CollectAllTrackedObjects(); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "PassTimeToNextDay")] private static void OnRoundEnded() { DungeonCullingInfo.ClearAll(); DynamicObjects.CollectAllTrackedObjects(); } } internal static class MapSeedOverride { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRound_StartPostfix(StartOfRound __instance) { if (int.TryParse(Config.OverrideMapSeed.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { __instance.overrideRandomSeed = true; __instance.overrideSeedNumber = result; } else { __instance.overrideRandomSeed = false; } } } [HarmonyPatch(typeof(EntranceTeleport))] public static class TeleportExtender { private static float[] _initialPlayerCameraFarPlanes; public static void SetInitialFarClipPlane() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (_initialPlayerCameraFarPlanes == null) { _initialPlayerCameraFarPlanes = new float[allPlayerScripts.Length]; for (int i = 0; i < allPlayerScripts.Length; i++) { _initialPlayerCameraFarPlanes[i] = allPlayerScripts[i].gameplayCamera.farClipPlane; } } if (!Config.CullDistanceEnabled.Value) { for (int j = 0; j < allPlayerScripts.Length; j++) { allPlayerScripts[j].gameplayCamera.farClipPlane = _initialPlayerCameraFarPlanes[j]; } } else { for (int k = 0; k < allPlayerScripts.Length; k++) { UpdateFarPlane(allPlayerScripts[k]); } } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void GameStarted() { SetInitialFarClipPlane(); DynamicObjects.CollectAllPlayerLights(); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "TeleportPlayer")] private static void OnTeleportPlayerController(PlayerControllerB __instance) { OnPlayerTeleported(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerClientRpc")] private static void OnTeleportOtherPlayerThroughEntrance(ref int playerObj) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; if (!((Object)(object)val == (Object)(object)StartOfRound.Instance.localPlayerController)) { OnPlayerTeleported(val); } } private static void OnPlayerTeleported(PlayerControllerB player) { UpdateFarPlane(player); DynamicObjects.OnPlayerTeleported(player); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "SetEnemyOutside")] private static void OnEnemySetOutsideOrInside(EnemyAI __instance) { OnEnemyTeleported(__instance); } private static void OnEnemyTeleported(EnemyAI enemy) { DynamicObjects.OnEnemyTeleported(enemy); } private static void UpdateFarPlane(PlayerControllerB player) { if (Config.CullDistanceEnabled.Value) { player.gameplayCamera.farClipPlane = (DynamicObjects.PlayerIsInInterior(player) ? Config.CullDistance.Value : Config.SurfaceCullDistance.Value); Plugin.Log(string.Format("{0} is{1} in the factory, set far plane distance to {2}", player.playerUsername, player.isInsideFactory ? string.Empty : " not", player.gameplayCamera.farClipPlane)); } } } } namespace CullFactory.Data { public enum CullingType { None, PortalOcclusionCulling, DepthCulling } public static class DungeonCullingInfo { private const int RendererIntrusionTileDepth = 2; private const float RendererIntrusionDistance = 0.01f; public static Bounds DungeonBounds; public static TileContents[] AllTileContents { get; private set; } public static Dictionary<Tile, TileContents> TileContentsForTile { get; private set; } public static Light[] AllLightsInDungeon { get; private set; } public static void OnLevelGenerated() { string name = ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name; Plugin.LogAlways($"{name} has finished generating with seed {StartOfRound.Instance.randomMapSeed}."); bool num = Array.IndexOf(Config.InteriorsWithFallbackPortals, name) != -1; if (num) { Plugin.LogAlways("Using tile bounds to determine the size of portals for " + name + "."); } double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble; CollectAllTileContents(num); Plugin.Log($"Preparing tile information for the dungeon took {(Time.realtimeSinceStartupAsDouble - realtimeSinceStartupAsDouble) * 1000.0:0.###}ms"); } public static void ClearAll() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (AllTileContents != null) { AllTileContents = null; TileContentsForTile.Clear(); AllLightsInDungeon = null; DungeonBounds = default(Bounds); } } public static void RefreshCullingInfo() { if (AllTileContents != null) { OnLevelGenerated(); } } private static void AddIntersectingRenderers(Bounds bounds, HashSet<Renderer> toCollection, HashSet<TileContents> visitedTiles, TileContents currentTile, int tilesLeft) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0058: Unknown result type (might be due to invalid IL or missing references) if (!visitedTiles.Add(currentTile)) { return; } Renderer[] renderers = currentTile.renderers; foreach (Renderer val in renderers) { Bounds bounds2 = val.bounds; if (((Bounds)(ref bounds2)).Intersects(bounds)) { toCollection.Add(val); } } if (--tilesLeft > 0) { Portal[] portals = currentTile.portals; foreach (Portal portal in portals) { AddIntersectingRenderers(bounds, toCollection, visitedTiles, portal.NextTile, tilesLeft - 1); } } visitedTiles.Remove(currentTile); } private static HashSet<Renderer> GetIntrudingRenderers(TileContents originTile) { //IL_0007: 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_0039: Unknown result type (might be due to invalid IL or missing references) HashSet<Renderer> hashSet = new HashSet<Renderer>(); Bounds bounds = originTile.bounds; ((Bounds)(ref bounds)).Expand(-0.01f); HashSet<TileContents> visitedTiles = new HashSet<TileContents> { originTile }; Portal[] portals = originTile.portals; foreach (Portal portal in portals) { AddIntersectingRenderers(bounds, hashSet, visitedTiles, portal.NextTile, 2); } return hashSet; } internal static bool ShouldShadowFadingBeDisabledForLight(HDAdditionalLightData light) { return (double)light.shadowFadeDistance >= (double)light.fadeDistance * 0.75 - 15.0; } internal static bool ShouldShadowFadingBeDisabledForLight(Light light) { if (!Config.DisableShadowDistanceFading.Value) { return false; } HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>(); if (component != null) { return ShouldShadowFadingBeDisabledForLight(component); } return false; } private static void CollectAllTileContents(bool derivePortalBoundsFromTile) { //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_0071: 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_0079: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0090: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) ReadOnlyCollection<Tile> allTiles = RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.AllTiles; TileContentsForTile = new Dictionary<Tile, TileContents>(allTiles.Count); List<Light> list = new List<Light>(); Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; foreach (Tile item in allTiles) { TileContents tileContents = new TileContents(item); TileContentsForTile[item] = tileContents; list.AddRange(tileContents.lights); Vector3 val3 = val; Bounds rendererBounds = tileContents.rendererBounds; val = Vector3.Min(val3, ((Bounds)(ref rendererBounds)).min); Vector3 val4 = val2; rendererBounds = tileContents.rendererBounds; val2 = Vector3.Max(val4, ((Bounds)(ref rendererBounds)).max); } AllTileContents = new TileContents[TileContentsForTile.Count]; int num = 0; foreach (TileContents value in TileContentsForTile.Values) { List<Doorway> usedDoorways = value.tile.UsedDoorways; int count = usedDoorways.Count; List<Portal> list2 = new List<Portal>(count); for (int i = 0; i < count; i++) { Doorway val5 = usedDoorways[i]; if (!((Object)(object)val5.ConnectedDoorway == (Object)null)) { list2.Add(new Portal(val5, derivePortalBoundsFromTile, TileContentsForTile[val5.ConnectedDoorway.Tile])); } } value.portals = list2.ToArray(); AllTileContents[num++] = value; } AllLightsInDungeon = list.ToArray(); ((Bounds)(ref DungeonBounds)).min = val; ((Bounds)(ref DungeonBounds)).max = val2; HashSet<Renderer>[] array = new HashSet<Renderer>[AllTileContents.Length]; for (num = 0; num < AllTileContents.Length; num++) { array[num] = GetIntrudingRenderers(AllTileContents[num]); } for (num = 0; num < AllTileContents.Length; num++) { TileContents tileContents2; Renderer[] renderers = (tileContents2 = AllTileContents[num]).renderers; HashSet<Renderer> hashSet = array[num]; int num2 = 0; Renderer[] array2 = (Renderer[])(object)new Renderer[renderers.Length + hashSet.Count]; ReadOnlySpan<Renderer> readOnlySpan = new ReadOnlySpan<Renderer>(renderers); readOnlySpan.CopyTo(new Span<Renderer>(array2).Slice(num2, readOnlySpan.Length)); num2 += readOnlySpan.Length; foreach (Renderer item2 in hashSet) { array2[num2] = item2; num2++; } tileContents2.renderers = array2; } foreach (var item3 in AllTileContents.SelectMany((TileContents tile) => tile.lights.Select((Light light) => (tile, light)))) { var (tileContents3, light2) = item3; if (!((Component)light2).gameObject.activeInHierarchy) { continue; } bool flag = light2.HasShadows(); bool lightPassesThroughWalls = ShouldShadowFadingBeDisabledForLight(light2) || light2.PassesThroughOccluders(); if (lightPassesThroughWalls) { TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents4 in allTileContents) { if (light2.Affects(tileContents4)) { Light[] externalLights = tileContents4.externalLights; int num3 = 0; Light[] array3 = (Light[])(object)new Light[1 + externalLights.Length]; ReadOnlySpan<Light> readOnlySpan2 = new ReadOnlySpan<Light>(externalLights); readOnlySpan2.CopyTo(new Span<Light>(array3).Slice(num3, readOnlySpan2.Length)); num3 += readOnlySpan2.Length; array3[num3] = light2; num3++; tileContents4.externalLights = array3; if (flag) { List<Renderer> list3 = new List<Renderer>(); list3.AddRange(tileContents4.externalRenderers.Union(tileContents3.renderers)); tileContents4.externalRenderers = list3.ToArray(); } } } } if (!flag) { continue; } Vector3 lightOrigin = ((Component)light2).transform.position; VisibilityTesting.CallForEachLineOfSight(lightOrigin, tileContents3, delegate(TileContents[] tiles, Plane[][] frustums, int index) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0056: 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_00d3: Unknown result type (might be due to invalid IL or missing references) if (index >= 1) { TileContents tileContents5 = tiles[index]; if (light2.Affects(tileContents5)) { bool flag2 = false; List<Renderer> list4 = new List<Renderer>(); for (int num4 = index - 1; num4 >= 0; num4--) { Renderer[] renderers2 = tiles[num4].renderers; foreach (Renderer val6 in renderers2) { Bounds bounds = val6.bounds; if (light2.Affects(bounds) && bounds.IntersectsFrustums(frustums, num4)) { flag2 = true; list4.Add(val6); } } } List<Renderer> list5 = new List<Renderer>(); list5.AddRange(tileContents5.externalRenderers.Union(list4)); tileContents5.externalRenderers = list5.ToArray(); if (flag2) { List<Plane> list6 = new List<Plane>(); for (int k = 1; k <= index; k++) { list6.AddRange(frustums[k]); } list6.AddRange(tileContents5.bounds.GetFarthestPlanes(lightOrigin)); Plane[][] externalLightLinesOfSight = tileContents5.externalLightLinesOfSight; int j = 0; Plane[][] array4 = new Plane[1 + externalLightLinesOfSight.Length][]; ReadOnlySpan<Plane[]> readOnlySpan3 = new ReadOnlySpan<Plane[]>(externalLightLinesOfSight); readOnlySpan3.CopyTo(new Span<Plane[]>(array4).Slice(j, readOnlySpan3.Length)); j += readOnlySpan3.Length; array4[j] = list6.ToArray(); j++; tileContents5.externalLightLinesOfSight = array4; if (!lightPassesThroughWalls) { Light[] externalLights2 = tileContents5.externalLights; j = 0; Light[] array5 = (Light[])(object)new Light[1 + externalLights2.Length]; ReadOnlySpan<Light> readOnlySpan4 = new ReadOnlySpan<Light>(externalLights2); readOnlySpan4.CopyTo(new Span<Light>(array5).Slice(j, readOnlySpan4.Length)); j += readOnlySpan4.Length; array5[j] = light2; j++; tileContents5.externalLights = array5; } } } } }); } } public static TileContents GetTileContents(this Vector3 point) { //IL_0011: 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_001a: 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_002a: 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) TileContents result = null; TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents in allTileContents) { Bounds val = tileContents.bounds; if (((Bounds)(ref val)).Contains(point)) { return tileContents; } val = tileContents.rendererBounds; if (((Bounds)(ref val)).Contains(point)) { result = tileContents; } } return result; } public static void CollectAllTilesWithinCameraFrustum(Camera camera, List<TileContents> intoList) { Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = AllTileContents; foreach (TileContents tileContents in allTileContents) { if (Geometry.TestPlanesAABB(ref array, ref tileContents.bounds)) { intoList.Add(tileContents); } } } } public static class DynamicObjects { public static readonly HashSet<Light> AllLightsOutside = new HashSet<Light>(); public static readonly HashSet<Light> AllLightsInInterior = new HashSet<Light>(); public static readonly HashSet<Light> AllUnpredictableLights = new HashSet<Light>(); public static HashSet<GrabbableObjectContents> AllGrabbableObjectContentsOutside = new HashSet<GrabbableObjectContents>(); public static HashSet<GrabbableObjectContents> AllGrabbableObjectContentsInInterior = new HashSet<GrabbableObjectContents>(); public static Dictionary<GrabbableObject, GrabbableObjectContents> GrabbableObjectToContents = new Dictionary<GrabbableObject, GrabbableObjectContents>(); public static Dictionary<EnemyAI, HashSet<GrabbableObjectContents>> ItemsHeldByEnemies = new Dictionary<EnemyAI, HashSet<GrabbableObjectContents>>(); private static Light[][] allPlayerLights; private static HashSet<GrabbableObjectContents> GrabbableObjectsToRefresh = new HashSet<GrabbableObjectContents>(); internal static void CollectAllPlayerLights() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = allPlayerScripts.Length; allPlayerLights = new Light[num][]; for (int i = 0; i < num; i++) { if (!((Object)(object)allPlayerScripts[i] == (Object)null)) { allPlayerLights[i] = ((Component)allPlayerScripts[i]).GetComponentsInChildren<Light>(true); } } } internal static bool IsInInterior(Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (DungeonCullingInfo.AllTileContents == null) { return false; } if (((Bounds)(ref DungeonCullingInfo.DungeonBounds)).Contains(position)) { return true; } return false; } internal static bool PlayerIsInInterior(PlayerControllerB player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return IsInInterior(((Component)player).transform.position); } internal static void MarkGrabbableObjectDirty(GrabbableObject item) { //IL_0001: 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_0025: Unknown result type (might be due to invalid IL or missing references) if (((Enum)((Object)item).hideFlags).HasFlag((Enum)(object)(HideFlags)52)) { return; } Scene scene = ((Component)item).gameObject.scene; if (((Scene)(ref scene)).isLoaded) { if (GrabbableObjectToContents.TryGetValue(item, out var value)) { AllLightsOutside.ExceptWith(value.lights); AllLightsInInterior.ExceptWith(value.lights); } else { Plugin.Log("Adding contents of " + ((Object)item).name); value = new GrabbableObjectContents(item); GrabbableObjectToContents[item] = value; } GrabbableObjectsToRefresh.Add(value); } } internal static void RefreshGrabbableObjects() { foreach (GrabbableObjectContents item in GrabbableObjectsToRefresh) { RefreshGrabbableObject(item); } GrabbableObjectsToRefresh.Clear(); } internal static void RefreshGrabbableObject(GrabbableObjectContents contents) { //IL_0022: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) GrabbableObject item = contents.item; if ((Object)(object)item == (Object)null) { return; } Plugin.Log($"Refreshing contents of {((Object)item).name} @ {((Component)item).transform.position}"); contents.SetVisible(visible: true); contents.CollectContents(); CullingMethod.Instance?.OnItemCreatedOrChanged(contents); Vector3 position = ((Component)item).transform.position; if ((Object)(object)item.parentObject != (Object)null) { position = item.parentObject.position; } if ((Object)(object)item.parentObject != (Object)null && ((Component)item.parentObject).transform.TryGetComponentInParent<EnemyAI>(out var component)) { contents.heldByEnemy = component; if (!ItemsHeldByEnemies.TryGetValue(component, out var value)) { ItemsHeldByEnemies.Add(component, value = new HashSet<GrabbableObjectContents>()); } value.Add(contents); } else if (contents.heldByEnemy != null) { if (ItemsHeldByEnemies.TryGetValue(contents.heldByEnemy, out var value2)) { value2.Remove(contents); } contents.heldByEnemy = null; } if (IsInInterior(position)) { AllLightsOutside.ExceptWith(contents.lights); AllLightsInInterior.UnionWith(contents.lights); AllGrabbableObjectContentsOutside.Remove(contents); AllGrabbableObjectContentsInInterior.Add(contents); } else { AllLightsOutside.UnionWith(contents.lights); AllLightsInInterior.ExceptWith(contents.lights); AllGrabbableObjectContentsOutside.Add(contents); AllGrabbableObjectContentsInInterior.Remove(contents); } } internal static void OnPlayerTeleported(PlayerControllerB player) { CollectAllPlayerLights(); int num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player); if (num == -1) { return; } Light[] other = allPlayerLights[num]; if (PlayerIsInInterior(player)) { AllLightsOutside.ExceptWith(other); AllLightsInInterior.UnionWith(other); } else { AllLightsOutside.UnionWith(other); AllLightsInInterior.ExceptWith(other); } GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null)) { MarkGrabbableObjectDirty(val); } } } internal static void OnEnemyTeleported(EnemyAI enemy) { if (!ItemsHeldByEnemies.TryGetValue(enemy, out var value)) { return; } foreach (GrabbableObjectContents item in value) { if (!((Object)(object)item.item == (Object)null)) { MarkGrabbableObjectDirty(item.item); } } } internal static void CollectAllLightsInWorld() { IEnumerable<Light> enumerable = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0).AsEnumerable(); if (DungeonCullingInfo.AllLightsInDungeon != null) { enumerable = enumerable.Except(DungeonCullingInfo.AllLightsInDungeon); } AllLightsOutside.UnionWith(enumerable.Where((Light light) => !((Bounds)(ref DungeonCullingInfo.DungeonBounds)).Contains(((Component)light).transform.position))); AllLightsInInterior.UnionWith(enumerable.Except(AllLightsOutside)); } internal static void CollectAllUnpredictableLights() { AllUnpredictableLights.Clear(); Light item = default(Light); if (((Component)StartOfRound.Instance.spectateCamera).TryGetComponent<Light>(ref item)) { AllUnpredictableLights.Add(item); } AllUnpredictableLights.UnionWith(((Component)StartOfRound.Instance.mapScreen.mapCamera).GetComponentsInChildren<Light>()); GameObject val = GameObject.Find("ImpMap"); if ((Object)(object)val != (Object)null) { AllUnpredictableLights.UnionWith(val.GetComponentsInChildren<Light>()); } UpdateAllUnpredictableLights(); } internal static void UpdateAllUnpredictableLights() { foreach (Light allUnpredictableLight in AllUnpredictableLights) { RefreshSpecificLight(allUnpredictableLight); } } internal static void RefreshSpecificLight(Light light) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)light == (Object)null || !((Behaviour)light).isActiveAndEnabled) { AllLightsOutside.Remove(light); AllLightsInInterior.Remove(light); } else if (IsInInterior(((Component)light).transform.position)) { AllLightsOutside.Remove(light); AllLightsInInterior.Add(light); } else { AllLightsInInterior.Remove(light); AllLightsOutside.Add(light); } } internal static void CollectAllTrackedObjects() { AllLightsOutside.Clear(); AllLightsInInterior.Clear(); AllGrabbableObjectContentsOutside.Clear(); AllGrabbableObjectContentsInInterior.Clear(); GrabbableObjectToContents.Clear(); ItemsHeldByEnemies.Clear(); CollectAllLightsInWorld(); CollectAllUnpredictableLights(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; for (int i = 0; i < allPlayerScripts.Length; i++) { OnPlayerTeleported(allPlayerScripts[i]); } GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsInactive)1, (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { MarkGrabbableObjectDirty(array[i]); } CullingMethod.Instance?.OnDynamicLightsCollected(); } } public sealed class GrabbableObjectContents : IEquatable<GrabbableObjectContents> { public static readonly Vector3 Vector3NaN = new Vector3(float.NaN, float.NaN, float.NaN); public readonly GrabbableObject item; public Renderer[] renderers; public Light[] lights; public Vector3[] boundingVertices; public Bounds bounds; public EnemyAI heldByEnemy; public bool HasBounds { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (float.IsNaN(((Bounds)(ref bounds)).center.x)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).center.y)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).center.z)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.x)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.y)) { return false; } if (float.IsNaN(((Bounds)(ref bounds)).extents.z)) { return false; } return true; } } public GrabbableObjectContents(GrabbableObject item) { this.item = item; renderers = Array.Empty<Renderer>(); lights = Array.Empty<Light>(); boundingVertices = Array.Empty<Vector3>(); base..ctor(); } public void CollectContents() { renderers = ((Component)item).GetComponentsInChildren<Renderer>(); lights = ((Component)item).GetComponentsInChildren<Light>(); CalculateLocalBounds(); } private void CalculateLocalBounds() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0046: 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_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_0054: 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_0061: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; Renderer[] array = renderers; foreach (Renderer val3 in array) { if (!((Object)(object)val3 == (Object)null) && val3.enabled && ((Component)val3).gameObject.activeInHierarchy) { Bounds val4 = val3.bounds; val = Vector3.Min(val, ((Bounds)(ref val4)).min); val2 = Vector3.Max(val2, ((Bounds)(ref val4)).max); } } if (((Vector3)(ref val)).Equals(Vector3.positiveInfinity) || ((Vector3)(ref val2)).Equals(Vector3.negativeInfinity)) { boundingVertices = Array.Empty<Vector3>(); return; } boundingVertices = BoundsUtility.GetVertices(val, val2); ((Component)item).transform.InverseTransformPoints((Span<Vector3>)boundingVertices); CalculateBounds(); } public void CalculateBounds() { //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_003f: 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) if (boundingVertices.Length == 0 || (Object)(object)item == (Object)null) { bounds = new Bounds(Vector3NaN, Vector3NaN); } else { bounds = GeometryUtility.CalculateBounds(boundingVertices, ((Component)item).transform.localToWorldMatrix); } } public bool IsVisible(Plane[] planes) { if (!HasBounds) { return false; } return Geometry.TestPlanesAABB(ref planes, ref bounds); } public bool IsVisible(Plane[][] planes, int lastIndex) { for (int i = 0; i <= lastIndex; i++) { if (!IsVisible(planes[i])) { return false; } } return true; } public bool IsWithin(Bounds bounds) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!HasBounds) { return false; } return ((Bounds)(ref this.bounds)).Intersects(bounds); } public bool IsWithin(TileContents tile) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return IsWithin(tile.rendererBounds); } public bool IsWithin(IEnumerable<TileContents> tiles) { foreach (TileContents tile in tiles) { if (IsWithin(tile)) { return true; } } return false; } public void SetVisible(bool visible) { Renderer[] array = renderers; foreach (Renderer val in array) { if (!((Object)(object)val == (Object)null)) { val.forceRenderingOff = !visible; } } } public override string ToString() { if ((Object)(object)item == (Object)null) { return "Destroyed"; } return ((Object)item).name; } public override int GetHashCode() { return ((object)item).GetHashCode(); } public bool Equals(GrabbableObjectContents other) { return item == other.item; } public override bool Equals(object other) { if (other is GrabbableObjectContents other2) { return Equals(other2); } return false; } } public class Portal { private const float PlaneOffset = 0.001f; public readonly Vector3[] Corners; public readonly Bounds Bounds; public readonly TileContents NextTile; private readonly Plane _plane; public Portal(Doorway doorway, bool useTileBounds, TileContents nextTile) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00ca: 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_003f: 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_004d: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00ff: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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) Transform transform = ((Component)doorway).transform; float num = doorway.Socket.Size.x / 2f; float y = doorway.Socket.Size.y; if (useTileBounds) { Bounds val = UnityUtil.InverseTransformBounds(transform, doorway.Tile.Bounds); num = Mathf.Min(0f - ((Bounds)(ref val)).min.x, ((Bounds)(ref val)).max.x); y = ((Bounds)(ref val)).max.y; } Corners = (Vector3[])(object)new Vector3[4] { new Vector3(num, 0f, 0f), new Vector3(num, y, 0f), new Vector3(0f - num, y, 0f), new Vector3(0f - num, 0f, 0f) }; for (int i = 0; i < Corners.Length; i++) { Corners[i] = transform.position + transform.rotation * Corners[i]; } Vector3 val2 = Corners[0]; Vector3 val3 = Corners[0]; for (int j = 1; j < Corners.Length; j++) { Vector3 val4 = Corners[j]; val2 = Vector3.Min(val2, val4); val3 = Vector3.Max(val3, val4); } Bounds bounds = default(Bounds); ((Bounds)(ref bounds)).min = val2; ((Bounds)(ref bounds)).max = val3; Bounds = bounds; NextTile = nextTile; _plane = new Plane(Corners[0], Corners[1], Corners[2]); ref readonly Plane plane = ref _plane; ((Plane)(ref plane)).distance = ((Plane)(ref plane)).distance - 0.001f; } internal void GetFrustumPlanesNonAlloc(Vector3 origin, Plane[] planes) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002e: 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_003f: 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_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) planes[0] = new Plane(Corners[0], Corners[1], origin); planes[1] = new Plane(Corners[1], Corners[2], origin); planes[2] = new Plane(Corners[2], Corners[3], origin); planes[3] = new Plane(Corners[3], Corners[0], origin); planes[4] = _plane; } internal Plane[] GetFrustumPlanes(Vector3 origin) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Plane[] array = (Plane[])(object)new Plane[5]; GetFrustumPlanesNonAlloc(origin, array); return array; } } public sealed class TileContents { private const float MaxRendererBoundsSizeIncreaseOverTileBounds = 40f; public readonly Tile tile; public readonly Bounds bounds; public Portal[] portals; public readonly Bounds rendererBounds; public Renderer[] renderers; public readonly Light[] lights; public Renderer[] externalRenderers = Array.Empty<Renderer>(); public Light[] externalLights = Array.Empty<Light>(); public Plane[][] externalLightLinesOfSight = Array.Empty<Plane[]>(); private static bool _warnedNullObject; public TileContents(Tile tile) { //IL_0061: 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_006b: 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_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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) this.tile = tile; if (tile.OverrideAutomaticTileBounds) { bounds = UnityUtil.CondenseBounds(tile.Bounds, (IEnumerable<Doorway>)((Component)tile).GetComponentsInChildren<Doorway>()); } else { bounds = UnityUtil.TransformBounds(((Component)tile).transform.parent, tile.Placement.Bounds); } List<Renderer> list = new List<Renderer>(((Component)tile).GetComponentsInChildren<Renderer>(true)); List<Light> list2 = new List<Light>(((Component)tile).GetComponentsInChildren<Light>(true)); foreach (Doorway usedDoorway in tile.UsedDoorways) { if (!((Object)(object)usedDoorway.doorComponent == (Object)null)) { list.AddRange(((Component)usedDoorway).GetComponentsInChildren<Renderer>(true)); list2.AddRange(((Component)usedDoorway).GetComponentsInChildren<Light>(true)); } } rendererBounds = bounds; foreach (Renderer item in list) { ((Bounds)(ref rendererBounds)).Encapsulate(item.bounds); } Bounds val = bounds; ((Bounds)(ref val)).Expand(40f); ((Bounds)(ref rendererBounds)).min = Vector3.Max(((Bounds)(ref rendererBounds)).min, ((Bounds)(ref val)).min); ((Bounds)(ref rendererBounds)).max = Vector3.Min(((Bounds)(ref rendererBounds)).max, ((Bounds)(ref val)).max); renderers = list.ToArray(); lights = list2.ToArray(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool IsInvalid(Component obj) { if ((Object)(object)obj == (Object)null) { if (!_warnedNullObject) { Plugin.LogWarning("A " + ((object)obj).GetType().Name + " in " + ((Object)tile).name + " was unexpectedly destroyed."); } _warnedNullObject = true; return true; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SetVisible(Renderer[] renderers, bool visible) { foreach (Renderer val in renderers) { if (!IsInvalid((Component)(object)val)) { val.forceRenderingOff = !visible; } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SetVisible(Light[] lights, bool visible) { int num = lights.Length; for (int i = 0; i < num; i++) { Light val = lights[i]; if (!IsInvalid((Component)(object)val)) { val.SetVisible(visible); } } } public void SetRenderersVisible(bool visible) { SetVisible(renderers, visible); } public void SetLightsVisible(bool visible) { SetVisible(lights, visible); } public void SetSelfVisible(bool visible) { SetRenderersVisible(visible); SetLightsVisible(visible); } public void SetExternalInfluencesVisible(bool visible) { SetVisible(externalRenderers, visible); SetVisible(externalLights, visible); } public override string ToString() { if ((Object)(object)tile == (Object)null) { return "Destroyed"; } return ((Object)tile).name; } } } namespace CullFactory.Behaviours.Visualization { internal class CullingVisualizer : MonoBehaviour { private const float TileBoundsInset = 0.00025f; private static readonly Color[] ColorRotation = (Color[])(object)new Color[6] { Color.red, Color.yellow, Color.green, Color.blue, Color.cyan, Color.grey }; private GameObject _portalVisualizersRoot; private GameObject _tileBoundsVisualizersRoot; private void OnEnable() { RefreshVisualizers(); } public void RefreshVisualizers() { SpawnPortalVisualizers(); SpawnTileBoundsVisualizers(); } private void SpawnPortalVisualizer(Transform prefab, Doorway doorway) { //IL_0018: 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_0039: 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_0058: Unknown result type (might be due to invalid IL or missing references) Transform obj = Object.Instantiate<Transform>(prefab, _portalVisualizersRoot.transform); obj.position = ((Component)doorway).transform.position; obj.rotation = ((Component)doorway).transform.rotation; obj.localScale = new Vector3(doorway.Socket.Size.x, doorway.Socket.Size.y, 1f); } private void SpawnPortalVisualizers() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Object.Destroy((Object)(object)_portalVisualizersRoot); if (!Config.VisualizePortals.Value) { return; } _portalVisualizersRoot = new GameObject("PortalVisualizers"); Transform val = CreatePortalVisualizer(); foreach (DoorwayConnection connection in RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.Connections) { SpawnPortalVisualizer(val, connection.A); SpawnPortalVisualizer(val, connection.B); } Object.Destroy((Object)(object)((Component)val).gameObject); } private void SpawnTileBoundsVisualizers() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) Object.Destroy((Object)(object)_tileBoundsVisualizersRoot); if (Config.VisualizeTileBounds.Value) { _tileBoundsVisualizersRoot = new GameObject("TileBoundsVisualizers"); Renderer val = CreateTileBoundsVisualizer(); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.00025f, 0.00025f, 0.00025f); for (int i = 0; i < DungeonCullingInfo.AllTileContents.Length; i++) { TileContents tileContents = DungeonCullingInfo.AllTileContents[i]; Renderer obj = Object.Instantiate<Renderer>(val, _tileBoundsVisualizersRoot.transform); Transform transform = ((Component)obj).transform; Bounds bounds = tileContents.bounds; transform.position = ((Bounds)(ref bounds)).center; Transform transform2 = ((Component)obj).transform; bounds = tileContents.bounds; transform2.localScale = ((Bounds)(ref bounds)).size - val2; obj.material.color = ColorRotation[i % ColorRotation.Length]; } Object.Destroy((Object)(object)((Component)val).gameObject); } } private static Transform CreatePortalVisualizer() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009c: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val).name = "PortalVisualizer"; Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); Renderer component = val.GetComponent<Renderer>(); component.material = new Material(Shader.Find("HDRP/Unlit")) { name = "PortalVisualizerMaterial", color = Color.white }; component.shadowCastingMode = (ShadowCastingMode)0; Mesh mesh = val.GetComponent<MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 0.5f, 0f - Config.VisualizedPortalOutsetDistance.Value); for (int i = 0; i < vertices.Length; i++) { ref Vector3 reference = ref vertices[i]; reference += val2; } mesh.vertices = vertices; mesh.RecalculateBounds(); return val.transform; } private static Renderer CreateTileBoundsVisualizer() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "TileBounds"; Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); Renderer component = obj.GetComponent<Renderer>(); component.material = new Material(Shader.Find("HDRP/Unlit")) { name = "TileBoundsVisualizerMaterial", color = Color.yellow }; component.shadowCastingMode = (ShadowCastingMode)0; Mesh sharedMesh = obj.GetComponent<MeshFilter>().sharedMesh; List<int> list = new List<int>(); list.AddRange(sharedMesh.triangles); list.AddRange(sharedMesh.triangles.Reverse()); sharedMesh.triangles = list.ToArray(); return component; } private void OnDisable() { Object.Destroy((Object)(object)_portalVisualizersRoot); Object.Destroy((Object)(object)_tileBoundsVisualizersRoot); } } } namespace CullFactory.Behaviours.CullingMethods { public abstract class CullingMethod : MonoBehaviour { public struct VisibilitySets { public readonly HashSet<TileContents> directTiles; public readonly HashSet<TileContents> indirectTiles; public readonly HashSet<GrabbableObjectContents> items; public readonly HashSet<Light> dynamicLights; public VisibilitySets() { directTiles = new HashSet<TileContents>(IdentityEqualityComparer<TileContents>.Instance); indirectTiles = new HashSet<TileContents>(IdentityEqualityComparer<TileContents>.Instance); items = new HashSet<GrabbableObjectContents>(EqualityComparer<GrabbableObjectContents>.Default); dynamicLights = new HashSet<Light>(IdentityEqualityComparer<Light>.Instance); } public void ClearAll() { directTiles.Clear(); indirectTiles.Clear(); items.Clear(); dynamicLights.Clear(); } } public const float ExtraShadowFadeDistance = 1.1111112f; protected Camera _hudCamera; protected bool _benchmarking; protected long _totalCalls; private float _updateInterval; private float _lastUpdateTime; private bool _renderedThisFrame; private List<Camera> _camerasToCullThisPass = new List<Camera>(); private VisibilitySets _visibility = new VisibilitySets(); private VisibilitySets _visibilityLastCall = new VisibilitySets(); private float[] _lightShadowFadeDistances; private Dictionary<LODGroup, float> _lastLODScreenHeights; protected TileContents _debugTile; private double _cullingTime; public static CullingMethod Instance { get; private set; } public static void Initialize() { if ((Object)(object)Instance != (Object)null) { Object.DestroyImmediate((Object)(object)Instance); Instance = null; } if ((Object)(object)RoundManager.Instance == (Object)null || (Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null) { return; } DungeonGenerator generator = RoundManager.Instance.dungeonGenerator.Generator; GameObject gameObject = ((Component)generator.CurrentDungeon).gameObject; CullingMethod cullingMethod = null; switch (Config.GetCullingType(generator.DungeonFlow)) { case CullingType.PortalOcclusionCulling: cullingMethod = gameObject.AddComponent<PortalOcclusionCuller>(); break; case CullingType.DepthCulling: cullingMethod = gameObject.AddComponent<DepthCuller>(); break; default: throw new ArgumentOutOfRangeException(); case CullingType.None: break; } if (!((Object)(object)cullingMethod == (Object)null)) { if (Config.UpdateFrequency.Value > 0f) { cullingMethod._updateInterval = 1f / Config.UpdateFrequency.Value; } else { cullingMethod._updateInterval = 0f; } } } private void Awake() { Instance = this; Canvas componentInParent = ((Component)HUDManager.Instance.HUDContainer.transform).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { _hudCamera = componentInParent.worldCamera; } else { Plugin.LogWarning("Failed to find the HUD canvas, culling will be calculated unnecessarily for the HUD camera."); } } private void OnEnable() { DungeonCullingInfo.AllTileContents.SetSelfVisible(visible: false); DynamicObjects.AllGrabbableObjectContentsOutside.SetVisible(visible: false); DynamicObjects.AllGrabbableObjectContentsInInterior.SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsOutside).SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsInInterior).SetVisible(visible: false); DisableShadowDistanceFading(); DisableInteriorLODCulling(); RenderPipelineManager.beginContextRendering += DoCulling; } internal void OnDynamicLightsCollected() { ((IEnumerable<Light>)DynamicObjects.AllLightsOutside).SetVisible(visible: false); ((IEnumerable<Light>)DynamicObjects.AllLightsInInterior).SetVisible(visible: false); ((IEnumerable<Light>)_visibilityLastCall.dynamicLights).SetVisible(visible: true); } internal void OnItemCreatedOrChanged(GrabbableObjectContents item) { item.SetVisible(_visibilityLastCall.items.Contains(item)); } protected virtual void BenchmarkEnded() { double num = _cullingTime / (double)_totalCalls; Plugin.Log($"Total culling time {num * 1000000.0:0.####} microseconds."); _cullingTime = 0.0; } private void Update() { if (Config.Logging.Value && UnityInput.Current.GetKey("LeftAlt") && UnityInput.Current.GetKeyUp("B")) { _benchmarking = !_benchmarking; if (!_benchmarking) { BenchmarkEnded(); _totalCalls = 0L; } } } private void LateUpdate() { _renderedThisFrame = false; } protected abstract void AddVisibleObjects(List<Camera> cameras, VisibilitySets visibility); protected void AddAllObjectsWithinOrthographicCamera(Camera camera, VisibilitySets visibility) { Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera); TileContents[] allTileContents = DungeonCullingInfo.AllTileContents; foreach (TileContents tileContents in allTileContents) {
CullFactoryBurstPlugin.dll
Decompiled 3 days agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using CullFactoryBurst; using Unity.Burst; using Unity.Mathematics; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.TestPlanesAABB_00000004$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeBoundsHeightInterval_00000007$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.AppendEdge_00000008$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ApplyFaceConfiguration_0000000A$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.EdgeHasPointInsideCone_0000000C$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.CandidatesHavePointInsideCone_0000000D$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.ConeIntersectsBounds_0000000E$BurstDirectCall))] [assembly: StaticTypeReinit(typeof(CullFactoryBurst.IsRunningBurstLibrary_00000012$BurstDirectCall))] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { MonoScriptData result = default(MonoScriptData); result.FilePathsData = new byte[98] { 0, 0, 0, 5, 0, 0, 0, 42, 92, 65, 115, 115, 101, 116, 115, 92, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 80, 108, 117, 103, 105, 110, 92, 71, 101, 111, 109, 101, 116, 114, 121, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 40, 92, 65, 115, 115, 101, 116, 115, 92, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 80, 108, 117, 103, 105, 110, 92, 80, 108, 117, 103, 105, 110, 46, 99, 115 }; result.TypesData = new byte[220] { 0, 0, 0, 0, 25, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 124, 71, 101, 111, 109, 101, 116, 114, 121, 0, 0, 0, 0, 30, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 67, 111, 110, 101, 0, 0, 0, 0, 37, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 69, 100, 103, 101, 73, 110, 100, 105, 99, 101, 115, 0, 0, 0, 0, 38, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 70, 97, 99, 101, 73, 110, 100, 101, 120, 83, 101, 116, 0, 0, 0, 0, 37, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 46, 71, 101, 111, 109, 101, 116, 114, 121, 124, 70, 97, 99, 101, 73, 110, 100, 105, 99, 101, 115, 0, 0, 0, 0, 23, 67, 117, 108, 108, 70, 97, 99, 116, 111, 114, 121, 66, 117, 114, 115, 116, 124, 80, 108, 117, 103, 105, 110 }; result.TotalFiles = 2; result.TotalTypes = 6; result.IsEditorOnly = false; return result; } } namespace CullFactoryBurst; [BurstCompile] public static class Geometry { private struct Cone { internal Vector3 origin; internal Vector3 direction; internal float length; internal float cosAngle; internal Cone(Vector3 origin, Vector3 direction, float length, float angle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.origin = origin; this.direction = direction; this.length = length; cosAngle = math.cos(math.radians(angle / 2f)); } } private struct EdgeIndices { internal int a; internal int b; internal EdgeIndices(int a, int b) { this.a = a; this.b = b; } } private struct FaceIndexSet { internal int a; internal int b; internal int c; internal int d; internal FaceIndexSet(int a, int b, int c, int d) { this.a = a; this.b = b; this.c = c; this.d = d; } } private struct FaceIndices { internal FaceIndexSet vertices; internal FaceIndexSet edges; internal FaceIndices(FaceIndexSet vertices, FaceIndexSet edges) { this.vertices = vertices; this.edges = edges; } } public unsafe delegate bool TestPlanesAABB_00000004$PostfixBurstDelegate(Plane* planes, int planeCount, in Bounds bounds); internal static class TestPlanesAABB_00000004$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(TestPlanesAABB_00000004$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static TestPlanesAABB_00000004$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(Plane* planes, int planeCount, in Bounds bounds) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<Plane*, int, ref Bounds, bool>)functionPointer)(planes, planeCount, ref bounds); } } return TestPlanesAABB$BurstManaged(planes, planeCount, in bounds); } } public delegate void ComputeBoundsHeightInterval_00000007$PostfixBurstDelegate(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight); internal static class ComputeBoundsHeightInterval_00000007$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeBoundsHeightInterval_00000007$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeBoundsHeightInterval_00000007$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref Bounds, ref Cone, ref float, ref float, void>)functionPointer)(ref bounds, ref cone, ref minHeight, ref maxHeight); return; } } ComputeBoundsHeightInterval$BurstManaged(in bounds, in cone, out minHeight, out maxHeight); } } public unsafe delegate void AppendEdge_00000008$PostfixBurstDelegate(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge); internal static class AppendEdge_00000008$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(AppendEdge_00000008$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static AppendEdge_00000008$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<EdgeIndices*, ref int, ref EdgeIndices, void>)functionPointer)(edges, ref edgeCount, ref edge); return; } } AppendEdge$BurstManaged(edges, ref edgeCount, in edge); } } public unsafe delegate void ComputeCandidatesOnBoundsEdges_00000009$PostfixBurstDelegate(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount); internal static class ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeCandidatesOnBoundsEdges_00000009$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref Cone, float3*, float*, float*, EdgeIndices*, ref int, void>)functionPointer)(ref cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); return; } } ComputeCandidatesOnBoundsEdges$BurstManaged(in cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } } public unsafe delegate void ApplyFaceConfiguration_0000000A$PostfixBurstDelegate(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount); internal static class ApplyFaceConfiguration_0000000A$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ApplyFaceConfiguration_0000000A$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ApplyFaceConfiguration_0000000A$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<ref FaceIndices, float*, int, EdgeIndices*, ref int, void>)functionPointer)(ref face, projections, baseIndex, candidates, ref candidateCount); return; } } ApplyFaceConfiguration$BurstManaged(in face, projections, baseIndex, candidates, ref candidateCount); } } public unsafe delegate void ComputeCandidatesOnBoundsFaces_0000000B$PostfixBurstDelegate(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount); internal static class ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ComputeCandidatesOnBoundsFaces_0000000B$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall() { Constructor(); } public unsafe static void Invoke(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { ((delegate* unmanaged[Cdecl]<float3*, float*, float*, EdgeIndices*, ref int, void>)functionPointer)(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); return; } } ComputeCandidatesOnBoundsFaces$BurstManaged(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } } public delegate bool EdgeHasPointInsideCone_0000000C$PostfixBurstDelegate(in float3 pointA, in float3 pointB, in Cone cone); internal static class EdgeHasPointInsideCone_0000000C$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(EdgeHasPointInsideCone_0000000C$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static EdgeHasPointInsideCone_0000000C$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in float3 pointA, in float3 pointB, in Cone cone) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref float3, ref float3, ref Cone, bool>)functionPointer)(ref pointA, ref pointB, ref cone); } } return EdgeHasPointInsideCone$BurstManaged(in pointA, in pointB, in cone); } } public unsafe delegate bool CandidatesHavePointInsideCone_0000000D$PostfixBurstDelegate(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount); internal static class CandidatesHavePointInsideCone_0000000D$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(CandidatesHavePointInsideCone_0000000D$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static CandidatesHavePointInsideCone_0000000D$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref Cone, float3*, EdgeIndices*, int, bool>)functionPointer)(ref cone, vertices, candidates, candidateCount); } } return CandidatesHavePointInsideCone$BurstManaged(in cone, vertices, candidates, candidateCount); } } public delegate bool ConeIntersectsBounds_0000000E$PostfixBurstDelegate(in Cone cone, in Bounds bounds); internal static class ConeIntersectsBounds_0000000E$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(ConeIntersectsBounds_0000000E$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static ConeIntersectsBounds_0000000E$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke(in Cone cone, in Bounds bounds) { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<ref Cone, ref Bounds, bool>)functionPointer)(ref cone, ref bounds); } } return ConeIntersectsBounds$BurstManaged(in cone, in bounds); } } private static bool WarnedCallWasNotBurstCompiled = false; private static readonly EdgeIndices[] edges = new EdgeIndices[12] { new EdgeIndices(0, 1), new EdgeIndices(1, 3), new EdgeIndices(2, 3), new EdgeIndices(0, 2), new EdgeIndices(4, 5), new EdgeIndices(5, 7), new EdgeIndices(6, 7), new EdgeIndices(4, 6), new EdgeIndices(0, 4), new EdgeIndices(1, 5), new EdgeIndices(3, 7), new EdgeIndices(2, 6) }; private const int CornerVertexCount = 8; private const int MaxVertexCount = 32; private const int ClipVerticesMinBaseIndex = 8; private const int ClipVerticesMaxBaseIndex = 20; private const int BoxEdgeCount = 12; private const int MaxEdgeCandidateCount = 496; private static readonly FaceIndices[] faces = new FaceIndices[6] { new FaceIndices(new FaceIndexSet(0, 4, 6, 2), new FaceIndexSet(8, 7, 11, 3)), new FaceIndices(new FaceIndexSet(1, 3, 7, 5), new FaceIndexSet(1, 10, 5, 9)), new FaceIndices(new FaceIndexSet(0, 1, 5, 4), new FaceIndexSet(0, 9, 4, 8)), new FaceIndices(new FaceIndexSet(2, 6, 7, 3), new FaceIndexSet(11, 6, 10, 2)), new FaceIndices(new FaceIndexSet(0, 2, 3, 1), new FaceIndexSet(3, 2, 1, 0)), new FaceIndices(new FaceIndexSet(4, 5, 7, 6), new FaceIndexSet(4, 5, 6, 7)) }; [BurstDiscard] public static void WarnIfNotBurstCompiled() { if (!WarnedCallWasNotBurstCompiled) { Debug.LogWarning((object)"Methods intended to be Burst-compiled in CullFactoryBurstPlugin are not using Burst."); WarnedCallWasNotBurstCompiled = true; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool TestPlanesAABB(Plane* planes, int planeCount, in Bounds bounds) { return TestPlanesAABB_00000004$BurstDirectCall.Invoke(planes, planeCount, in bounds); } public unsafe static bool TestPlanesAABB(in Plane[] planes, in Bounds bounds) { fixed (Plane* planes2 = planes) { return TestPlanesAABB(planes2, planes.Length, in bounds); } } public unsafe static bool TestPlanesAABB(in Span<Plane> planes, in Bounds bounds) { fixed (Plane* planes2 = planes) { return TestPlanesAABB(planes2, planes.Length, in bounds); } } [BurstCompile(/*Could not decode attribute arguments.*/)] private static void ComputeBoundsHeightInterval(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { ComputeBoundsHeightInterval_00000007$BurstDirectCall.Invoke(in bounds, in cone, out minHeight, out maxHeight); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void AppendEdge(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { AppendEdge_00000008$BurstDirectCall.Invoke(edges, ref edgeCount, in edge); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ComputeCandidatesOnBoundsEdges(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall.Invoke(in cone, vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ApplyFaceConfiguration(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { ApplyFaceConfiguration_0000000A$BurstDirectCall.Invoke(in face, projections, baseIndex, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static void ComputeCandidatesOnBoundsFaces(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall.Invoke(vertices, projectionsMin, projectionsMax, candidates, ref candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private static bool EdgeHasPointInsideCone(in float3 pointA, in float3 pointB, in Cone cone) { return EdgeHasPointInsideCone_0000000C$BurstDirectCall.Invoke(in pointA, in pointB, in cone); } [BurstCompile(/*Could not decode attribute arguments.*/)] private unsafe static bool CandidatesHavePointInsideCone(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { return CandidatesHavePointInsideCone_0000000D$BurstDirectCall.Invoke(in cone, vertices, candidates, candidateCount); } [BurstCompile(/*Could not decode attribute arguments.*/)] private static bool ConeIntersectsBounds(in Cone cone, in Bounds bounds) { return ConeIntersectsBounds_0000000E$BurstDirectCall.Invoke(in cone, in bounds); } public static bool SpotLightInfluencesBounds(in Light light, in Bounds bounds) { //IL_000b: 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) Transform transform = ((Component)light).transform; Cone cone = new Cone(transform.position, transform.forward, light.range, light.spotAngle); return ConeIntersectsBounds(in cone, in bounds); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool TestPlanesAABB$BurstManaged(Plane* planes, int planeCount, in Bounds bounds) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004f: 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_0060: 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_0073: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00cc: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) WarnIfNotBurstCompiled(); for (int i = 0; i < planeCount; i++) { Plane val = (Plane)((byte*)planes)[(nint)i * (nint)Unsafe.SizeOf<Plane>()]; float x = ((Plane)(ref val)).normal.x; Bounds val2 = bounds; float num = x * ((Bounds)(ref val2)).center.x; float y = ((Plane)(ref val)).normal.y; val2 = bounds; float num2 = num + y * ((Bounds)(ref val2)).center.y; float z = ((Plane)(ref val)).normal.z; val2 = bounds; float num3 = num2 + z * ((Bounds)(ref val2)).center.z; float num4 = math.abs(((Plane)(ref val)).normal.x); val2 = bounds; float num5 = num4 * ((Bounds)(ref val2)).extents.x; float num6 = math.abs(((Plane)(ref val)).normal.y); val2 = bounds; float num7 = num5 + num6 * ((Bounds)(ref val2)).extents.y; float num8 = math.abs(((Plane)(ref val)).normal.z); val2 = bounds; float num9 = num7 + num8 * ((Bounds)(ref val2)).extents.z; if (num3 + num9 + ((Plane)(ref val)).distance <= 0f) { return false; } } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public static void ComputeBoundsHeightInterval$BurstManaged(in Bounds bounds, in Cone cone, out float minHeight, out float maxHeight) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0037: 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_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_0043: 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_0045: 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_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: 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_0092: 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) Bounds val = bounds; float3 val2 = float3.op_Implicit(((Bounds)(ref val)).center); val = bounds; float3 val3 = float3.op_Implicit(((Bounds)(ref val)).extents); float3 val4 = float3.op_Implicit(cone.origin); float3 val5 = float3.op_Implicit(cone.direction); float num = math.dot(val5, val2 - val4); val = bounds; float num2 = ((Bounds)(ref val)).extents.x * math.abs(val5.x); val = bounds; float num3 = num2 + ((Bounds)(ref val)).extents.y * math.abs(val5.y) + val3.z * math.abs(val5.z); minHeight = num - num3; maxHeight = num + num3; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void AppendEdge$BurstManaged(EdgeIndices* edges, ref int edgeCount, in EdgeIndices edge) { edges[edgeCount++] = edge; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ComputeCandidatesOnBoundsEdges$BurstManaged(in Cone cone, float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_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_00f0: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) for (int i = 0; i < 8; i++) { float num = math.dot(float3.op_Implicit(cone.direction), (float3)((byte*)vertices)[(nint)i * (nint)Unsafe.SizeOf<float3>()]); projectionsMin[i] = 0f - num; projectionsMax[i] = num - cone.length; } int num2 = 8; int num3 = 20; for (int num4 = 0; num4 < 12; num4++) { EdgeIndices edge = edges[num4]; float num5 = projectionsMin[edge.a]; float num6 = projectionsMin[edge.b]; int num7; if (!(num5 < 0f) || !(num6 > 0f)) { if (num5 > 0f) { num7 = ((num6 < 0f) ? 1 : 0); if (num7 != 0) { goto IL_00ab; } } else { num7 = 0; } goto IL_0104; } num7 = 1; goto IL_00ab; IL_00ab: Unsafe.Write((byte*)vertices + (nint)num2 * (nint)Unsafe.SizeOf<float3>(), (num6 * (float3)((byte*)vertices)[(nint)edge.a * (nint)Unsafe.SizeOf<float3>()] - num5 * (float3)((byte*)vertices)[(nint)edge.b * (nint)Unsafe.SizeOf<float3>()]) / (num6 - num5)); goto IL_0104; IL_0104: float num8 = projectionsMax[edge.a]; float num9 = projectionsMax[edge.b]; bool flag = (num8 < 0f && num9 > 0f) || (num8 > 0f && num9 < 0f); if (flag) { Unsafe.Write((byte*)vertices + (nint)num3 * (nint)Unsafe.SizeOf<float3>(), (num9 * (float3)((byte*)vertices)[(nint)edge.a * (nint)Unsafe.SizeOf<float3>()] - num8 * (float3)((byte*)vertices)[(nint)edge.b * (nint)Unsafe.SizeOf<float3>()]) / (num9 - num8)); } if (num7 != 0) { if (flag) { EdgeIndices edge2 = new EdgeIndices(num2, num3); AppendEdge(candidates, ref candidateCount, in edge2); } else if (num5 < 0f) { EdgeIndices edge2 = new EdgeIndices(edge.a, num2); AppendEdge(candidates, ref candidateCount, in edge2); } else { EdgeIndices edge2 = new EdgeIndices(edge.b, num2); AppendEdge(candidates, ref candidateCount, in edge2); } } else if (flag) { if (num8 < 0f) { EdgeIndices edge2 = new EdgeIndices(edge.a, num3); AppendEdge(candidates, ref candidateCount, in edge2); } else { EdgeIndices edge2 = new EdgeIndices(edge.b, num3); AppendEdge(candidates, ref candidateCount, in edge2); } } else if (num5 <= 0f && num6 <= 0f && num8 <= 0f && num9 <= 0f) { AppendEdge(candidates, ref candidateCount, in edge); } num2++; num3++; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ApplyFaceConfiguration$BurstManaged(in FaceIndices face, float* projections, int baseIndex, EdgeIndices* candidates, ref int candidateCount) { float num = projections[face.vertices.a]; float num2 = projections[face.vertices.b]; float num3 = projections[face.vertices.c]; float num4 = projections[face.vertices.d]; int num5 = ((!(num < 0f)) ? ((!(num > 0f)) ? 1 : 2) : 0); int num6 = ((!(num2 < 0f)) ? ((!(num2 > 0f)) ? 1 : 2) : 0); int num7 = ((!(num3 < 0f)) ? ((!(num3 > 0f)) ? 1 : 2) : 0); switch (((!(num4 < 0f)) ? ((!(num4 > 0f)) ? 1 : 2) : 0) + 3 * (num7 + 3 * (num6 + 3 * num5))) { case 2: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 5: { EdgeIndices edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 6: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 7: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 8: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 11: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 14: { EdgeIndices edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 15: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 16: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 17: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 18: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 19: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 20: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 21: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 22: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 23: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 24: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 25: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 26: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 29: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 32: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 33: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 34: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 35: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 38: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 41: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 42: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 43: { EdgeIndices edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 45: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 46: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 47: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 48: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 49: { EdgeIndices edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 51: { EdgeIndices edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 54: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 55: { EdgeIndices edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 56: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 57: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 58: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 59: { EdgeIndices edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); break; } case 60: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 61: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, baseIndex + face.edges.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(baseIndex + face.edges.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, face.vertices.d); AppendEdge(candidates, ref candidateCount, in edge); break; } case 62: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.a, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 63: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 64: { EdgeIndices edge = new EdgeIndices(face.vertices.d, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 65: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 66: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 69: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, face.vertices.a); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.a, face.vertices.b); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.b, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); edge = new EdgeIndices(face.vertices.c, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 72: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 73: { EdgeIndices edge = new EdgeIndices(face.vertices.d, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 74: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, baseIndex + face.edges.b); AppendEdge(candidates, ref candidateCount, in edge); break; } case 75: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.c, face.vertices.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 78: { EdgeIndices edge = new EdgeIndices(baseIndex + face.edges.d, baseIndex + face.edges.c); AppendEdge(candidates, ref candidateCount, in edge); break; } case 3: case 4: case 9: case 10: case 12: case 13: case 27: case 28: case 30: case 31: case 36: case 37: case 39: case 40: case 44: case 50: case 52: case 53: case 67: case 68: case 70: case 71: case 76: case 77: break; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static void ComputeCandidatesOnBoundsFaces$BurstManaged(float3* vertices, float* projectionsMin, float* projectionsMax, EdgeIndices* candidates, ref int candidateCount) { for (int i = 0; i < 6; i++) { FaceIndices face = faces[i]; ApplyFaceConfiguration(in face, projectionsMin, 8, candidates, ref candidateCount); ApplyFaceConfiguration(in face, projectionsMax, 20, candidates, ref candidateCount); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public static bool EdgeHasPointInsideCone$BurstManaged(in float3 pointA, in float3 pointB, in Cone cone) { //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_000c: 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_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_003e: 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) //IL_0065: 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_0075: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0093: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (math.dot(float3.op_Implicit(cone.direction), pointA) - cone.cosAngle * math.length(pointA) > 0f) { return true; } if (math.dot(float3.op_Implicit(cone.direction), pointB) - cone.cosAngle * math.length(pointB) > 0f) { return true; } float3 val = pointB - pointA; float3 val2 = math.cross(pointA, float3.op_Implicit(cone.direction)); float3 val3 = math.cross(pointA, val); float num = math.dot(val3, val2); if (num > 0f) { float3 val4 = math.cross(pointB, float3.op_Implicit(cone.direction)); float num2 = math.dot(val3, val4); if (num2 < 0f) { float num3 = num / (num - num2); float3 val5 = pointA + num3 * val; if (math.dot(float3.op_Implicit(cone.direction), val5) - cone.cosAngle * math.length(val5) > 0f) { return true; } } } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool CandidatesHavePointInsideCone$BurstManaged(in Cone cone, float3* vertices, EdgeIndices* candidates, int candidateCount) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) for (int i = 0; i < candidateCount; i++) { EdgeIndices edgeIndices = candidates[i]; float3 pointA = (float3)((byte*)vertices)[(nint)edgeIndices.a * (nint)Unsafe.SizeOf<float3>()]; float3 pointB = (float3)((byte*)vertices)[(nint)edgeIndices.b * (nint)Unsafe.SizeOf<float3>()]; if (EdgeHasPointInsideCone(in pointA, in pointB, in cone)) { return true; } } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile(/*Could not decode attribute arguments.*/)] public unsafe static bool ConeIntersectsBounds$BurstManaged(in Cone cone, in Bounds bounds) { //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_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) //IL_0038: 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_004e: 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_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_005e: 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_0066: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b0: 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_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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_010a: 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) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0143: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) WarnIfNotBurstCompiled(); ComputeBoundsHeightInterval(in bounds, in cone, out var minHeight, out var maxHeight); if (maxHeight <= 0f || minHeight >= cone.length) { return false; } Bounds val = bounds; float num = default(float); if (((Bounds)(ref val)).IntersectRay(new Ray(cone.origin, cone.direction), ref num)) { return true; } val = bounds; float3 val2 = float3.op_Implicit(((Bounds)(ref val)).min); val = bounds; float3 val3 = float3.op_Implicit(((Bounds)(ref val)).max); float3 val4 = float3.op_Implicit(cone.origin); float3* ptr = (float3*)stackalloc float3[32]; Unsafe.Write(ptr, new float3(val2.x, val2.y, val2.z) - val4); Unsafe.Write((byte*)ptr + Unsafe.SizeOf<float3>(), new float3(val3.x, val2.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)2 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val3.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)3 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val3.y, val2.z) - val4); Unsafe.Write((byte*)ptr + (nint)4 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val2.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)5 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val2.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)6 * (nint)Unsafe.SizeOf<float3>(), new float3(val2.x, val3.y, val3.z) - val4); Unsafe.Write((byte*)ptr + (nint)7 * (nint)Unsafe.SizeOf<float3>(), new float3(val3.x, val3.y, val3.z) - val4); EdgeIndices* ptr2 = stackalloc EdgeIndices[1024]; int candidateCount = 0; if (minHeight >= 0f && maxHeight <= cone.length) { for (int i = 0; i < 12; i++) { ptr2[i] = edges[i]; candidateCount++; } return CandidatesHavePointInsideCone(in cone, ptr, ptr2, candidateCount); } float* projectionsMin = stackalloc float[8]; float* projectionsMax = stackalloc float[8]; ComputeCandidatesOnBoundsEdges(in cone, ptr, projectionsMin, projectionsMax, ptr2, ref candidateCount); ComputeCandidatesOnBoundsFaces(ptr, projectionsMin, projectionsMax, ptr2, ref candidateCount); return CandidatesHavePointInsideCone(in cone, ptr, ptr2, candidateCount); } } [BurstCompile] public static class Plugin { public delegate bool IsRunningBurstLibrary_00000012$PostfixBurstDelegate(); internal static class IsRunningBurstLibrary_00000012$BurstDirectCall { private static IntPtr Pointer; private static IntPtr DeferredCompilation; [BurstDiscard] private unsafe static void GetFunctionPointerDiscard(ref IntPtr P_0) { if (Pointer == (IntPtr)0) { Pointer = (nint)BurstCompiler.GetILPPMethodFunctionPointer2(DeferredCompilation, (RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/, typeof(IsRunningBurstLibrary_00000012$PostfixBurstDelegate).TypeHandle); } P_0 = Pointer; } private static IntPtr GetFunctionPointer() { nint result = 0; GetFunctionPointerDiscard(ref result); return result; } public static void Constructor() { DeferredCompilation = BurstCompiler.CompileILPPMethod2((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/); } public static void Initialize() { } static IsRunningBurstLibrary_00000012$BurstDirectCall() { Constructor(); } public unsafe static bool Invoke() { if (BurstCompiler.IsEnabled) { IntPtr functionPointer = GetFunctionPointer(); if (functionPointer != (IntPtr)0) { return ((delegate* unmanaged[Cdecl]<bool>)functionPointer)(); } } return IsRunningBurstLibrary$BurstManaged(); } } [BurstDiscard] private static void SetValueFalseIfManaged(ref bool value) { value = false; } [BurstCompile] public static bool IsRunningBurstLibrary() { return IsRunningBurstLibrary_00000012$BurstDirectCall.Invoke(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [BurstCompile] public static bool IsRunningBurstLibrary$BurstManaged() { bool value = true; SetValueFalseIfManaged(ref value); return value; } } internal static class $BurstDirectCallInitializer { [RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)] private static void Initialize() { Geometry.TestPlanesAABB_00000004$BurstDirectCall.Initialize(); Geometry.ComputeBoundsHeightInterval_00000007$BurstDirectCall.Initialize(); Geometry.AppendEdge_00000008$BurstDirectCall.Initialize(); Geometry.ComputeCandidatesOnBoundsEdges_00000009$BurstDirectCall.Initialize(); Geometry.ApplyFaceConfiguration_0000000A$BurstDirectCall.Initialize(); Geometry.ComputeCandidatesOnBoundsFaces_0000000B$BurstDirectCall.Initialize(); Geometry.EdgeHasPointInsideCone_0000000C$BurstDirectCall.Initialize(); Geometry.CandidatesHavePointInsideCone_0000000D$BurstDirectCall.Initialize(); Geometry.ConeIntersectsBounds_0000000E$BurstDirectCall.Initialize(); Plugin.IsRunningBurstLibrary_00000012$BurstDirectCall.Initialize(); } }