using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEditor;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
public bool OnlyDeactivate;
private void OnEnable()
{
((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
}
private IEnumerator CheckIfAlive()
{
do
{
yield return (object)new WaitForSeconds(0.5f);
}
while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
if (OnlyDeactivate)
{
((Component)this).gameObject.SetActive(false);
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
public float duration = 1f;
public float delay = 0f;
public float finalIntensity = 0f;
private float baseIntensity;
public bool autodestruct;
private float p_lifetime = 0f;
private float p_delay;
private void Start()
{
baseIntensity = ((Component)this).GetComponent<Light>().intensity;
}
private void OnEnable()
{
p_lifetime = 0f;
p_delay = delay;
if (delay > 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
}
}
private void Update()
{
if (p_delay > 0f)
{
p_delay -= Time.deltaTime;
if (p_delay <= 0f)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
}
}
else if (p_lifetime / duration < 1f)
{
((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
p_lifetime += Time.deltaTime;
}
else if (autodestruct)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
{
new Vector2(0f, 0f),
new Vector2(0f, 1f),
new Vector2(1f, 0f),
new Vector2(1f, 1f)
};
public float lifetime = 10f;
public float fadeoutpercent = 80f;
public Vector2 frames;
public bool randomRotation = false;
public bool deactivate = false;
private float life;
private float fadeout;
private Color color;
private float orgAlpha;
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
orgAlpha = color.a;
}
private void OnEnable()
{
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
int num = Random.Range(0, (int)(frames.x * frames.y));
int num2 = (int)((float)num % frames.x);
int num3 = (int)((float)num / frames.y);
Vector2[] array = (Vector2[])(object)new Vector2[4];
for (int i = 0; i < 4; i++)
{
array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
}
((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
if (randomRotation)
{
((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
}
life = lifetime;
fadeout = life * (fadeoutpercent / 100f);
color.a = orgAlpha;
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
((MonoBehaviour)this).StopAllCoroutines();
((MonoBehaviour)this).StartCoroutine("holeUpdate");
}
private IEnumerator holeUpdate()
{
while (life > 0f)
{
life -= Time.deltaTime;
if (life <= fadeout)
{
color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
}
yield return null;
}
}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
public float time = 0.05f;
private float timer;
private void Start()
{
timer = time;
((MonoBehaviour)this).StartCoroutine("Flicker");
}
private IEnumerator Flicker()
{
while (true)
{
((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
do
{
timer -= Time.deltaTime;
yield return null;
}
while (timer > 0f);
timer = time;
}
}
}
namespace Packer
{
[RequireComponent(typeof(AudioSource))]
public class Door : MonoBehaviour
{
[Tooltip("How fast the door opens (Meters a second)")]
public float doorSpeed = 1f;
[Tooltip("Default State of this door")]
public bool open = false;
[Tooltip("The closed local position of the door")]
public Vector3 closeOffset;
[Tooltip("The opened local position of the door")]
public Vector3 openOffset;
public AudioClip openSound;
public AudioClip closeSound;
private AudioSource audioSource;
private void Update()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0034: 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_004b: 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_0094: 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)
if (open && ((Component)this).transform.localPosition != openOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, openOffset, doorSpeed * Time.deltaTime);
}
else if (!open && ((Component)this).transform.localPosition != closeOffset)
{
((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, closeOffset, doorSpeed * Time.deltaTime);
}
}
public void SetDoor(bool state)
{
open = state;
if (open)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
public void SetOpenOffset()
{
//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)
if (!ErrorCheck())
{
openOffset = ((Component)this).transform.localPosition;
}
}
public void SetCloseOffset()
{
//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)
if (!ErrorCheck())
{
closeOffset = ((Component)this).transform.localPosition;
}
}
public void MoveToOpenOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = openOffset;
}
}
public void MoveToCloseOffset()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!ErrorCheck())
{
((Component)this).transform.localPosition = closeOffset;
}
}
private bool ErrorCheck()
{
if ((Object)(object)((Component)this).transform.parent == (Object)null)
{
Debug.LogError((object)(((Object)this).name + " is missing a parent gameobject"));
return true;
}
return false;
}
}
[RequireComponent(typeof(AudioSource), typeof(BoxCollider))]
public class DoorSwitch : MonoBehaviour
{
[Tooltip("All the doors that will be triggered when this switch is hit")]
public Door[] doors;
[Tooltip("All Switches that will be set to this switches state")]
public DoorSwitch[] switches;
[Tooltip("Default switch state")]
public bool switchState = false;
public AudioClip openSound;
public AudioClip closeSound;
private BoxCollider triggerZone;
private LayerMask mask;
private AudioSource audioSource;
private float timeout = 0f;
private void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
triggerZone = ((Component)this).GetComponent<BoxCollider>();
((Collider)triggerZone).isTrigger = true;
((Component)this).gameObject.layer = LayerMask.NameToLayer("Enviroment");
}
private void Update()
{
if (timeout > 0f)
{
timeout = Mathf.Clamp(timeout -= Time.deltaTime, 0f, 1f);
}
}
private void ToggleDoors()
{
switchState = !switchState;
for (int i = 0; i < doors.Length; i++)
{
if ((Object)(object)doors[i] != (Object)null)
{
doors[i].SetDoor(switchState);
}
}
for (int j = 0; j < switches.Length; j++)
{
if ((Object)(object)switches[j] != (Object)null)
{
switches[j].switchState = switchState;
}
}
if (switchState)
{
if ((Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
}
else if ((Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
}
private void OnTriggerEnter(Collider collider)
{
if (!(timeout > 0f))
{
timeout = 1f;
ToggleDoors();
}
}
}
}
namespace ShermanJumbo.TnH_Refueling_Base
{
[BepInPlugin("ShermanJumbo.TnH_Refueling_Base", "TnH_Refueling_Base", "1.0.3")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("nrgill28.Atlas", "1.0.1")]
public class TnH_Refueling_BasePlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "ShermanJumbo.TnH_Refueling_Base");
AtlasPlugin.RegisterScene(Path.Combine(BasePath, "refuelingbasetnh"));
}
}
}
namespace SimpleLightProbePlacer
{
[RequireComponent(typeof(LightProbeGroup))]
[AddComponentMenu("Rendering/Light Probe Group Control")]
public class LightProbeGroupControl : MonoBehaviour
{
[SerializeField]
private float m_mergeDistance = 0.5f;
[SerializeField]
private bool m_usePointLights = true;
[SerializeField]
private float m_pointLightRange = 1f;
private int m_mergedProbes;
private LightProbeGroup m_lightProbeGroup;
public float MergeDistance
{
get
{
return m_mergeDistance;
}
set
{
m_mergeDistance = value;
}
}
public int MergedProbes => m_mergedProbes;
public bool UsePointLights
{
get
{
return m_usePointLights;
}
set
{
m_usePointLights = value;
}
}
public float PointLightRange
{
get
{
return m_pointLightRange;
}
set
{
m_pointLightRange = value;
}
}
public LightProbeGroup LightProbeGroup
{
get
{
if ((Object)(object)m_lightProbeGroup != (Object)null)
{
return m_lightProbeGroup;
}
return m_lightProbeGroup = ((Component)this).GetComponent<LightProbeGroup>();
}
}
public void DeleteAll()
{
LightProbeGroup.probePositions = null;
m_mergedProbes = 0;
}
public void Create()
{
DeleteAll();
List<Vector3> list = CreatePositions();
list.AddRange(CreateAroundPointLights(m_pointLightRange));
list = MergeClosestPositions(list, m_mergeDistance, out m_mergedProbes);
ApplyPositions(list);
}
public void Merge()
{
if (LightProbeGroup.probePositions != null)
{
List<Vector3> source = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes);
source = source.Select((Vector3 x) => ((Component)this).transform.TransformPoint(x)).ToList();
ApplyPositions(source);
}
}
private void ApplyPositions(List<Vector3> positions)
{
LightProbeGroup.probePositions = positions.Select((Vector3 x) => ((Component)this).transform.InverseTransformPoint(x)).ToArray();
}
private static List<Vector3> CreatePositions()
{
LightProbeVolume[] array = Object.FindObjectsOfType<LightProbeVolume>();
if (array.Length == 0)
{
return new List<Vector3>();
}
List<Vector3> list = new List<Vector3>();
for (int i = 0; i < array.Length; i++)
{
list.AddRange(array[i].CreatePositions());
}
return list;
}
private static List<Vector3> CreateAroundPointLights(float range)
{
List<Light> list = (from x in Object.FindObjectsOfType<Light>()
where (int)x.type == 2
select x).ToList();
if (list.Count == 0)
{
return new List<Vector3>();
}
List<Vector3> list2 = new List<Vector3>();
for (int i = 0; i < list.Count; i++)
{
list2.AddRange(CreatePositionsAround(((Component)list[i]).transform, range));
}
return list2;
}
private static List<Vector3> MergeClosestPositions(List<Vector3> positions, float distance, out int mergedCount)
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
if (positions == null)
{
mergedCount = 0;
return new List<Vector3>();
}
int count = positions.Count;
bool flag = false;
while (!flag)
{
Dictionary<Vector3, List<Vector3>> dictionary = new Dictionary<Vector3, List<Vector3>>();
for (int i = 0; i < positions.Count; i++)
{
List<Vector3> list = positions.Where(delegate(Vector3 x)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
Vector3 val2 = x - positions[i];
return ((Vector3)(ref val2)).magnitude < distance;
}).ToList();
if (list.Count > 0 && !dictionary.ContainsKey(positions[i]))
{
dictionary.Add(positions[i], list);
}
}
positions.Clear();
List<Vector3> list2 = dictionary.Keys.ToList();
for (int j = 0; j < list2.Count; j++)
{
Vector3 center = dictionary[list2[j]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[j]].Count;
if (!positions.Exists((Vector3 x) => x == center))
{
positions.Add(center);
}
}
flag = positions.Select((Vector3 x) => positions.Where(delegate(Vector3 y)
{
//IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
int result2;
if (y != x)
{
Vector3 val = y - x;
result2 = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0);
}
else
{
result2 = 0;
}
return (byte)result2 != 0;
})).All((IEnumerable<Vector3> x) => !x.Any());
}
mergedCount = count - positions.Count;
return positions;
}
public static List<Vector3> CreatePositionsAround(Transform transform, float range)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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)
//IL_00f6: 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_0116: Unknown result type (might be due to invalid IL or missing references)
Vector3[] source = (Vector3[])(object)new Vector3[8]
{
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, -0.5f)
};
return source.Select((Vector3 x) => transform.TransformPoint(x * range)).ToList();
}
}
public enum LightProbeVolumeType
{
Fixed,
Float
}
[AddComponentMenu("Rendering/Light Probe Volume")]
public class LightProbeVolume : TransformVolume
{
[SerializeField]
private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed;
[SerializeField]
private Vector3 m_densityFixed = Vector3.one;
[SerializeField]
private Vector3 m_densityFloat = Vector3.one;
public LightProbeVolumeType Type
{
get
{
return m_type;
}
set
{
m_type = value;
}
}
public Vector3 Density
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
return (m_type != 0) ? m_densityFloat : m_densityFixed;
}
set
{
//IL_0019: 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_000d: 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)
if (m_type == LightProbeVolumeType.Fixed)
{
m_densityFixed = value;
}
else
{
m_densityFloat = value;
}
}
}
public static Color EditorColor => new Color(1f, 0.9f, 0.25f);
public List<Vector3> CreatePositions()
{
return CreatePositions(m_type);
}
public List<Vector3> CreatePositions(LightProbeVolumeType type)
{
//IL_0030: 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_003c: 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)
return (type != 0) ? CreatePositionsFloat(((Component)this).transform, base.Origin, base.Size, Density) : CreatePositionsFixed(((Component)this).transform, base.Origin, base.Size, Density);
}
public static List<Vector3> CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
{
//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)
//IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_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_0094: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Vector3 val = origin;
float num = size.x / (float)Mathf.FloorToInt(density.x);
float num2 = size.y / (float)Mathf.FloorToInt(density.y);
float num3 = size.z / (float)Mathf.FloorToInt(density.z);
val -= size * 0.5f;
for (int i = 0; (float)i <= density.x; i++)
{
for (int j = 0; (float)j <= density.y; j++)
{
for (int k = 0; (float)k <= density.z; k++)
{
Vector3 val2 = val + new Vector3((float)i * num, (float)j * num2, (float)k * num3);
val2 = volumeTransform.TransformPoint(val2);
list.Add(val2);
}
}
}
return list;
}
public static List<Vector3> CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
{
//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)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Vector3 val = origin;
int num = Mathf.FloorToInt(size.x / density.x);
int num2 = Mathf.FloorToInt(size.y / density.y);
int num3 = Mathf.FloorToInt(size.z / density.z);
val -= size * 0.5f;
val.x += (size.x - (float)num * density.x) * 0.5f;
val.y += (size.y - (float)num2 * density.y) * 0.5f;
val.z += (size.z - (float)num3 * density.z) * 0.5f;
for (int i = 0; i <= num; i++)
{
for (int j = 0; j <= num2; j++)
{
for (int k = 0; k <= num3; k++)
{
Vector3 val2 = val + new Vector3((float)i * density.x, (float)j * density.y, (float)k * density.z);
val2 = volumeTransform.TransformPoint(val2);
list.Add(val2);
}
}
}
return list;
}
}
[AddComponentMenu("")]
public class TransformVolume : MonoBehaviour
{
[SerializeField]
private Volume m_volume = new Volume(Vector3.zero, Vector3.one);
public Volume Volume
{
get
{
return m_volume;
}
set
{
m_volume = value;
}
}
public Vector3 Origin => m_volume.Origin;
public Vector3 Size => m_volume.Size;
public bool IsInBounds(Vector3[] points)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = GetBounds();
return ((Bounds)(ref bounds)).Intersects(GetBounds(points));
}
public bool IsOnBorder(Vector3[] points)
{
if (points.All((Vector3 x) => !IsInVolume(x)))
{
return false;
}
return !points.All(IsInVolume);
}
public bool IsInVolume(Vector3[] points)
{
return points.All(IsInVolume);
}
public bool IsInVolume(Vector3 position)
{
//IL_000d: 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_0020: Unknown result type (might be due to invalid IL or missing references)
Plane val = default(Plane);
for (int i = 0; i < 6; i++)
{
((Plane)(ref val))..ctor(GetSideDirection(i), GetSidePosition(i));
if (((Plane)(ref val)).GetSide(position))
{
return false;
}
}
return true;
}
public Vector3[] GetCorners()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_0102: 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_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: 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_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01ac: 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)
Vector3[] array = (Vector3[])(object)new Vector3[8]
{
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, -0.5f)
};
for (int i = 0; i < array.Length; i++)
{
ref Vector3 reference = ref array[i];
reference.x *= m_volume.Size.x;
ref Vector3 reference2 = ref array[i];
reference2.y *= m_volume.Size.y;
ref Vector3 reference3 = ref array[i];
reference3.z *= m_volume.Size.z;
ref Vector3 reference4 = ref array[i];
reference4 = ((Component)this).transform.TransformPoint(m_volume.Origin + array[i]);
}
return array;
}
public Bounds GetBounds()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
return GetBounds(GetCorners());
}
public Bounds GetBounds(Vector3[] points)
{
//IL_0002: 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_002d: 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_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0070: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = points.Aggregate(Vector3.zero, (Vector3 result, Vector3 point) => result + point) / (float)points.Length;
Bounds result2 = default(Bounds);
((Bounds)(ref result2))..ctor(val, Vector3.zero);
for (int i = 0; i < points.Length; i++)
{
((Bounds)(ref result2)).Encapsulate(points[i]);
}
return result2;
}
public GameObject[] GetGameObjectsInBounds(LayerMask layerMask)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>();
List<GameObject> list = new List<GameObject>();
Bounds bounds = GetBounds();
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)((Component)this).transform).gameObject) && !((Object)(object)((Component)array[i]).GetComponent<TransformVolume>() != (Object)null) && ((1 << ((Component)array[i]).gameObject.layer) & ((LayerMask)(ref layerMask)).value) != 0 && ((Bounds)(ref bounds)).Intersects(((Renderer)array[i]).bounds))
{
list.Add(((Component)array[i]).gameObject);
}
}
return list.ToArray();
}
public Vector3 GetSideDirection(int side)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0019: 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)
//IL_0022: 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_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_0040: 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_004d: 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_005f: 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_006c: 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_0072: 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_008e: 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)
Vector3[] array = (Vector3[])(object)new Vector3[6];
Vector3 right = Vector3.right;
Vector3 up = Vector3.up;
Vector3 forward = Vector3.forward;
array[0] = right;
ref Vector3 reference = ref array[1];
reference = -right;
array[2] = up;
ref Vector3 reference2 = ref array[3];
reference2 = -up;
array[4] = forward;
ref Vector3 reference3 = ref array[5];
reference3 = -forward;
return ((Component)this).transform.TransformDirection(array[side]);
}
public Vector3 GetSidePosition(int side)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0019: 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)
//IL_0022: 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_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_0040: 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_004d: 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_005f: 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_006c: 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_0072: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
Vector3[] array = (Vector3[])(object)new Vector3[6];
Vector3 right = Vector3.right;
Vector3 up = Vector3.up;
Vector3 forward = Vector3.forward;
array[0] = right;
ref Vector3 reference = ref array[1];
reference = -right;
array[2] = up;
ref Vector3 reference2 = ref array[3];
reference2 = -up;
array[4] = forward;
ref Vector3 reference3 = ref array[5];
reference3 = -forward;
return ((Component)this).transform.TransformPoint(array[side] * GetSizeAxis(side) + m_volume.Origin);
}
public float GetSizeAxis(int side)
{
//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_0041: 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_0060: 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)
switch (side)
{
case 0:
case 1:
return m_volume.Size.x * 0.5f;
case 2:
case 3:
return m_volume.Size.y * 0.5f;
default:
return m_volume.Size.z * 0.5f;
}
}
public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color)
{
//IL_000f: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: 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)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
//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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//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_016a: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Expected O, but got Unknown
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
Vector3[] array = (Vector3[])(object)new Vector3[6];
Transform transform = ((Component)transformVolume).transform;
Handles.color = color;
for (int i = 0; i < array.Length; i++)
{
ref Vector3 reference = ref array[i];
reference = transformVolume.GetSidePosition(i);
}
ref Vector3 reference2 = ref array[0];
reference2 = Handles.Slider(array[0], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference3 = ref array[1];
reference3 = Handles.Slider(array[1], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference4 = ref array[2];
reference4 = Handles.Slider(array[2], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference5 = ref array[3];
reference5 = Handles.Slider(array[3], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference6 = ref array[4];
reference6 = Handles.Slider(array[4], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
ref Vector3 reference7 = ref array[5];
reference7 = Handles.Slider(array[5], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
Vector3 origin = default(Vector3);
origin.x = transform.InverseTransformPoint((array[0] + array[1]) * 0.5f).x;
origin.y = transform.InverseTransformPoint((array[2] + array[3]) * 0.5f).y;
origin.z = transform.InverseTransformPoint((array[4] + array[5]) * 0.5f).z;
Vector3 size = default(Vector3);
size.x = transform.InverseTransformPoint(array[0]).x - transform.InverseTransformPoint(array[1]).x;
size.y = transform.InverseTransformPoint(array[2]).y - transform.InverseTransformPoint(array[3]).y;
size.z = transform.InverseTransformPoint(array[4]).z - transform.InverseTransformPoint(array[5]).z;
return new Volume(origin, size);
}
}
[Serializable]
public struct Volume
{
[SerializeField]
private Vector3 m_origin;
[SerializeField]
private Vector3 m_size;
public Vector3 Origin => m_origin;
public Vector3 Size => m_size;
public Volume(Vector3 origin, Vector3 size)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
m_origin = origin;
m_size = size;
}
public static bool operator ==(Volume left, Volume right)
{
return left.Equals(right);
}
public static bool operator !=(Volume left, Volume right)
{
return !left.Equals(right);
}
public bool Equals(Volume other)
{
//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)
//IL_0019: 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)
return Origin == other.Origin && Size == other.Size;
}
public override bool Equals(object obj)
{
if (object.ReferenceEquals(null, obj))
{
return false;
}
return obj is Volume && Equals((Volume)obj);
}
public override int GetHashCode()
{
//IL_0003: 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_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)
Vector3 origin = Origin;
int num = ((object)(Vector3)(ref origin)).GetHashCode() * 397;
Vector3 size = Size;
return num ^ ((object)(Vector3)(ref size)).GetHashCode();
}
public override string ToString()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
return $"Origin: {Origin}, Size: {Size}";
}
}
}
public class CuttableMesh
{
private MeshRenderer inputMeshRenderer;
private bool hasUvs;
private bool hasUv1s;
private bool hasColours;
private List<CuttableSubMesh> subMeshes;
public CuttableMesh(Mesh inputMesh)
{
Init(inputMesh, ((Object)inputMesh).name);
}
public CuttableMesh(MeshRenderer input)
{
inputMeshRenderer = input;
MeshFilter component = ((Component)input).GetComponent<MeshFilter>();
Mesh sharedMesh = component.sharedMesh;
Init(sharedMesh, ((Object)input).name);
}
public CuttableMesh(CuttableMesh inputMesh, List<CuttableSubMesh> newSubMeshes)
{
inputMeshRenderer = inputMesh.inputMeshRenderer;
hasUvs = inputMesh.hasUvs;
hasUv1s = inputMesh.hasUv1s;
hasColours = inputMesh.hasColours;
subMeshes = new List<CuttableSubMesh>();
subMeshes.AddRange(newSubMeshes);
}
private void Init(Mesh inputMesh, string debugName)
{
subMeshes = new List<CuttableSubMesh>();
if (inputMesh.isReadable)
{
Vector3[] vertices = inputMesh.vertices;
Vector3[] normals = inputMesh.normals;
Vector2[] uv = inputMesh.uv;
Vector2[] uv2 = inputMesh.uv2;
Color32[] colors = inputMesh.colors32;
hasUvs = uv != null && uv.Length > 0;
hasUv1s = uv2 != null && uv2.Length > 0;
hasColours = colors != null && colors.Length > 0;
for (int i = 0; i < inputMesh.subMeshCount; i++)
{
int[] indices = inputMesh.GetIndices(i);
CuttableSubMesh item = new CuttableSubMesh(indices, vertices, normals, colors, uv, uv2);
subMeshes.Add(item);
}
}
else
{
Debug.LogError((object)("CuttableMesh's input mesh is not readable: " + debugName), (Object)(object)inputMesh);
}
}
public void Add(CuttableMesh other)
{
if (subMeshes.Count != other.subMeshes.Count)
{
throw new Exception("Mismatched submesh count");
}
for (int i = 0; i < subMeshes.Count; i++)
{
subMeshes[i].Add(other.subMeshes[i]);
}
}
public int NumSubMeshes()
{
return subMeshes.Count;
}
public bool HasUvs()
{
return hasUvs;
}
public bool HasColours()
{
return hasColours;
}
public List<CuttableSubMesh> GetSubMeshes()
{
return subMeshes;
}
public CuttableSubMesh GetSubMesh(int index)
{
return subMeshes[index];
}
public Transform GetTransform()
{
if ((Object)(object)inputMeshRenderer != (Object)null)
{
return ((Component)inputMeshRenderer).transform;
}
return null;
}
public MeshRenderer ConvertToRenderer(string newObjectName)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003d: 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_005d: 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_0097: 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)
Mesh val = CreateMesh();
if (val.vertexCount == 0)
{
return null;
}
GameObject val2 = new GameObject(newObjectName);
val2.transform.SetParent(((Component)inputMeshRenderer).transform);
val2.transform.localPosition = Vector3.zero;
val2.transform.localRotation = Quaternion.identity;
val2.transform.localScale = Vector3.one;
MeshFilter val3 = val2.AddComponent<MeshFilter>();
val3.mesh = val;
MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
((Renderer)val4).shadowCastingMode = ((Renderer)inputMeshRenderer).shadowCastingMode;
((Renderer)val4).reflectionProbeUsage = ((Renderer)inputMeshRenderer).reflectionProbeUsage;
((Renderer)val4).lightProbeUsage = ((Renderer)inputMeshRenderer).lightProbeUsage;
((Renderer)val4).sharedMaterials = ((Renderer)inputMeshRenderer).sharedMaterials;
return val4;
}
public Mesh CreateMesh()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
Mesh val = new Mesh();
int num = 0;
for (int i = 0; i < subMeshes.Count; i++)
{
num += subMeshes[i].NumIndices();
}
List<Vector3> list = new List<Vector3>();
List<Vector3> list2 = new List<Vector3>();
List<Color32> list3 = ((!hasColours) ? null : new List<Color32>());
List<Vector2> list4 = ((!hasUvs) ? null : new List<Vector2>());
List<Vector2> list5 = ((!hasUv1s) ? null : new List<Vector2>());
List<int> list6 = new List<int>();
foreach (CuttableSubMesh subMesh in subMeshes)
{
list6.Add(list.Count);
subMesh.AddTo(list, list2, list3, list4, list5);
}
val.vertices = list.ToArray();
val.normals = list2.ToArray();
val.colors32 = ((!hasColours) ? null : list3.ToArray());
val.uv = ((!hasUvs) ? null : list4.ToArray());
val.uv2 = ((!hasUv1s) ? null : list5.ToArray());
val.subMeshCount = subMeshes.Count;
for (int j = 0; j < subMeshes.Count; j++)
{
CuttableSubMesh cuttableSubMesh = subMeshes[j];
int num2 = list6[j];
int[] array = cuttableSubMesh.GenIndices();
for (int k = 0; k < array.Length; k++)
{
array[k] += num2;
}
val.SetTriangles(array, j, true);
}
return val;
}
}
public class CuttableSubMesh
{
private List<Vector3> vertices;
private List<Vector3> normals;
private List<Color32> colours;
private List<Vector2> uvs;
private List<Vector2> uv1s;
public CuttableSubMesh(bool hasNormals, bool hasColours, bool hasUvs, bool hasUv1)
{
vertices = new List<Vector3>();
if (hasNormals)
{
normals = new List<Vector3>();
}
if (hasColours)
{
colours = new List<Color32>();
}
if (hasUvs)
{
uvs = new List<Vector2>();
}
if (hasUv1)
{
uv1s = new List<Vector2>();
}
}
public CuttableSubMesh(int[] indices, Vector3[] inputVertices, Vector3[] inputNormals, Color32[] inputColours, Vector2[] inputUvs, Vector2[] inputUv1)
{
//IL_0099: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
vertices = new List<Vector3>();
if (inputNormals != null && inputNormals.Length > 0)
{
normals = new List<Vector3>();
}
if (inputColours != null && inputColours.Length > 0)
{
colours = new List<Color32>();
}
if (inputUvs != null && inputUvs.Length > 0)
{
uvs = new List<Vector2>();
}
if (inputUv1 != null && inputUv1.Length > 0)
{
uv1s = new List<Vector2>();
}
foreach (int num in indices)
{
vertices.Add(inputVertices[num]);
if (normals != null)
{
normals.Add(inputNormals[num]);
}
if (colours != null)
{
colours.Add(inputColours[num]);
}
if (uvs != null)
{
uvs.Add(inputUvs[num]);
}
if (uv1s != null)
{
uv1s.Add(inputUv1[num]);
}
}
}
public void Add(CuttableSubMesh other)
{
for (int i = 0; i < other.vertices.Count; i++)
{
CopyVertex(i, other);
}
}
public int NumVertices()
{
return vertices.Count;
}
public Vector3 GetVertex(int index)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
return vertices[index];
}
public bool HasNormals()
{
return normals != null;
}
public bool HasColours()
{
return colours != null;
}
public bool HasUvs()
{
return uvs != null;
}
public bool HasUv1()
{
return uv1s != null;
}
public void CopyVertex(int srcIndex, CuttableSubMesh srcMesh)
{
//IL_000e: 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_0052: 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_0096: Unknown result type (might be due to invalid IL or missing references)
vertices.Add(srcMesh.vertices[srcIndex]);
if (normals != null)
{
normals.Add(srcMesh.normals[srcIndex]);
}
if (colours != null)
{
colours.Add(srcMesh.colours[srcIndex]);
}
if (uvs != null)
{
uvs.Add(srcMesh.uvs[srcIndex]);
}
if (uv1s != null)
{
uv1s.Add(srcMesh.uv1s[srcIndex]);
}
}
public void AddInterpolatedVertex(int i0, int i1, float weight, CuttableSubMesh srcMesh)
{
//IL_0004: 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)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_001c: 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_004c: 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_005a: 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_008a: 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_00b3: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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)
Vector3 vertex = srcMesh.GetVertex(i0);
Vector3 vertex2 = srcMesh.GetVertex(i1);
vertices.Add(Vector3.Lerp(vertex, vertex2, weight));
if (normals != null)
{
List<Vector3> list = normals;
Vector3 val = Vector3.Lerp(srcMesh.normals[i0], srcMesh.normals[i1], weight);
list.Add(((Vector3)(ref val)).normalized);
}
if (colours != null)
{
colours.Add(Color32.Lerp(srcMesh.colours[i0], srcMesh.colours[i1], weight));
}
if (uvs != null)
{
uvs.Add(Vector2.Lerp(srcMesh.uvs[i0], srcMesh.uvs[i1], weight));
}
if (uv1s != null)
{
uv1s.Add(Vector2.Lerp(srcMesh.uv1s[i0], srcMesh.uv1s[i1], weight));
}
}
public void AddTo(List<Vector3> destVertices, List<Vector3> destNormals, List<Color32> destColours, List<Vector2> destUvs, List<Vector2> destUv1s)
{
destVertices.AddRange(vertices);
if (normals != null)
{
destNormals.AddRange(normals);
}
if (colours != null)
{
destColours.AddRange(colours);
}
if (uvs != null)
{
destUvs.AddRange(uvs);
}
if (uv1s != null)
{
destUv1s.AddRange(uv1s);
}
}
public int NumIndices()
{
return vertices.Count;
}
public int[] GenIndices()
{
int[] array = new int[vertices.Count];
for (int i = 0; i < array.Length; i++)
{
array[i] = i;
}
return array;
}
}
public enum VertexClassification
{
Front = 1,
Back = 2,
OnPlane = 4
}
public class MeshCutter
{
private CuttableMesh inputMesh;
private List<CuttableSubMesh> outputFrontSubMeshes;
private List<CuttableSubMesh> outputBackSubMeshes;
public void Cut(CuttableMesh input, Plane worldCutPlane)
{
//IL_0067: 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_0038: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
inputMesh = input;
outputFrontSubMeshes = new List<CuttableSubMesh>();
outputBackSubMeshes = new List<CuttableSubMesh>();
Transform transform = inputMesh.GetTransform();
Plane cutPlane = default(Plane);
if ((Object)(object)transform != (Object)null)
{
Vector3 val = transform.InverseTransformPoint(ClosestPointOnPlane(worldCutPlane, Vector3.zero));
Vector3 val2 = transform.InverseTransformDirection(((Plane)(ref worldCutPlane)).normal);
((Plane)(ref cutPlane))..ctor(val2, val);
}
else
{
cutPlane = worldCutPlane;
}
foreach (CuttableSubMesh subMesh in input.GetSubMeshes())
{
Cut(subMesh, cutPlane);
}
}
private static Vector3 ClosestPointOnPlane(Plane plane, Vector3 point)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
float distanceToPoint = ((Plane)(ref plane)).GetDistanceToPoint(point);
if (((Plane)(ref plane)).GetSide(point))
{
return point - ((Plane)(ref plane)).normal * distanceToPoint;
}
return point + ((Plane)(ref plane)).normal * distanceToPoint;
}
public CuttableMesh GetFrontOutput()
{
return new CuttableMesh(inputMesh, outputFrontSubMeshes);
}
public CuttableMesh GetBackOutput()
{
return new CuttableMesh(inputMesh, outputBackSubMeshes);
}
private void Cut(CuttableSubMesh inputSubMesh, Plane cutPlane)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0068: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0081: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
bool hasNormals = inputSubMesh.HasNormals();
bool hasColours = inputSubMesh.HasColours();
bool hasUvs = inputSubMesh.HasUvs();
bool hasUv = inputSubMesh.HasUv1();
CuttableSubMesh cuttableSubMesh = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
CuttableSubMesh cuttableSubMesh2 = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
for (int i = 0; i < inputSubMesh.NumVertices(); i += 3)
{
int num = i;
int num2 = i + 1;
int num3 = i + 2;
Vector3 vertex = inputSubMesh.GetVertex(num);
Vector3 vertex2 = inputSubMesh.GetVertex(num2);
Vector3 vertex3 = inputSubMesh.GetVertex(num3);
VertexClassification vertexClassification = Classify(vertex, cutPlane);
VertexClassification vertexClassification2 = Classify(vertex2, cutPlane);
VertexClassification vertexClassification3 = Classify(vertex3, cutPlane);
int numFront = 0;
int numBehind = 0;
CountSides(vertexClassification, ref numFront, ref numBehind);
CountSides(vertexClassification2, ref numFront, ref numBehind);
CountSides(vertexClassification3, ref numFront, ref numBehind);
if (numFront > 0 && numBehind == 0)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh);
}
else if (numFront == 0 && numBehind > 0)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2);
}
else if (numFront == 2 && numBehind == 1)
{
if (vertexClassification == VertexClassification.Back)
{
SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
else if (vertexClassification2 == VertexClassification.Back)
{
SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
else
{
SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
}
}
else if (numFront == 1 && numBehind == 2)
{
if (vertexClassification == VertexClassification.Front)
{
SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else if (vertexClassification2 == VertexClassification.Front)
{
SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
}
else if (numFront == 1 && numBehind == 1)
{
if (vertexClassification == VertexClassification.OnPlane)
{
if (vertexClassification3 == VertexClassification.Front)
{
SplitB(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitBFlipped(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
continue;
}
switch (vertexClassification2)
{
case VertexClassification.OnPlane:
if (vertexClassification == VertexClassification.Front)
{
SplitB(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
else
{
SplitBFlipped(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
}
break;
case VertexClassification.Front:
SplitB(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
break;
default:
SplitBFlipped(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
break;
}
}
else if (numFront == 0 && numBehind == 0)
{
Vector3 val = vertex2 - vertex;
Vector3 val2 = vertex3 - vertex;
Vector3 val3 = Vector3.Cross(val, val2);
if (Vector3.Dot(val3, ((Plane)(ref cutPlane)).normal) > 0f)
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2);
}
else
{
KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh);
}
}
}
outputFrontSubMeshes.Add(cuttableSubMesh);
outputBackSubMeshes.Add(cuttableSubMesh2);
}
private VertexClassification Classify(Vector3 vertex, Plane cutPlane)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(vertex.x, vertex.y, vertex.z);
float distanceToPoint = ((Plane)(ref cutPlane)).GetDistanceToPoint(val);
double num = 9.999999747378752E-06;
if ((double)distanceToPoint > 0.0 - num && (double)distanceToPoint < num)
{
return VertexClassification.OnPlane;
}
if (distanceToPoint > 0f)
{
return VertexClassification.Front;
}
return VertexClassification.Back;
}
private void CountSides(VertexClassification c, ref int numFront, ref int numBehind)
{
switch (c)
{
case VertexClassification.Front:
numFront++;
break;
case VertexClassification.Back:
numBehind++;
break;
}
}
private void KeepTriangle(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, CuttableSubMesh destSubMesh)
{
destSubMesh.CopyVertex(i0, inputSubMesh);
destSubMesh.CopyVertex(i1, inputSubMesh);
destSubMesh.CopyVertex(i2, inputSubMesh);
}
private void SplitA(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: 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)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i1);
Vector3 vertex3 = inputSubMesh.GetVertex(i2);
CalcIntersection(vertex, vertex2, cutPlane, out var weight);
CalcIntersection(vertex3, vertex, cutPlane, out var weight2);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
}
private void SplitB(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: 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)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i2);
CalcIntersection(vertex2, vertex, cutPlane, out var weight);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.CopyVertex(i1, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh);
}
private void SplitBFlipped(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh)
{
//IL_0004: 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)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
Vector3 vertex = inputSubMesh.GetVertex(i0);
Vector3 vertex2 = inputSubMesh.GetVertex(i1);
CalcIntersection(vertex, vertex2, cutPlane, out var weight);
frontSubMesh.CopyVertex(i0, inputSubMesh);
frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
frontSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.CopyVertex(i1, inputSubMesh);
backSubMesh.CopyVertex(i2, inputSubMesh);
backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh);
}
private Vector3 CalcIntersection(Vector3 v0, Vector3 v1, Plane plane, out float weight)
{
//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_0003: 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_0013: 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_0022: 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_0034: 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_0044: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = v1 - v0;
float magnitude = ((Vector3)(ref val)).magnitude;
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(v0, val / magnitude);
float num = default(float);
((Plane)(ref plane)).Raycast(val2, ref num);
Vector3 result = ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * num;
weight = num / magnitude;
return result;
}
}