860 lines
33 KiB
C#
860 lines
33 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using Cpp2IlInjected;
|
|
using RecRoom.Core.Creation.Shapes;
|
|
using RecRoom.Persistence;
|
|
using Unity.Jobs;
|
|
using UnityEngine;
|
|
|
|
namespace ClusterLOD
|
|
{
|
|
// Token: 0x02001272 RID: 4722
|
|
[Token(Token = "0x2001272")]
|
|
public class ClusterLODManager : MonoBehaviour
|
|
{
|
|
// Token: 0x17001153 RID: 4435
|
|
// (get) Token: 0x06006B22 RID: 27426 RVA: 0x0017BE34 File Offset: 0x0017A034
|
|
// (set) Token: 0x06006B23 RID: 27427 RVA: 0x0017BE48 File Offset: 0x0017A048
|
|
[Token(Token = "0x17001153")]
|
|
public ClusterLODConfig Config
|
|
{
|
|
[Token(Token = "0x6006B22")]
|
|
[Address(RVA = "0x3F5F40", Offset = "0x3F4D40", VA = "0x1803F5F40")]
|
|
get;
|
|
[Token(Token = "0x6006B23")]
|
|
[Address(RVA = "0x3F7210", Offset = "0x3F6010", VA = "0x1803F7210")]
|
|
private set;
|
|
}
|
|
|
|
// Token: 0x17001154 RID: 4436
|
|
// (get) Token: 0x06006B24 RID: 27428 RVA: 0x0000220F File Offset: 0x0000040F
|
|
// (set) Token: 0x06006B25 RID: 27429 RVA: 0x0017BE5C File Offset: 0x0017A05C
|
|
[Token(Token = "0x17001154")]
|
|
public Vector3 EyePos
|
|
{
|
|
[Token(Token = "0x6006B24")]
|
|
[Address(RVA = "0xA9E600", Offset = "0xA9D400", VA = "0x180A9E600")]
|
|
[CompilerGenerated]
|
|
get
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
[Token(Token = "0x6006B25")]
|
|
[Address(RVA = "0xA9E200", Offset = "0xA9D000", VA = "0x180A9E200")]
|
|
[CompilerGenerated]
|
|
private set
|
|
{
|
|
float z = value.z;
|
|
this.<EyePos>k__BackingField.z = z;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001155 RID: 4437
|
|
// (get) Token: 0x06006B26 RID: 27430 RVA: 0x0017BE7C File Offset: 0x0017A07C
|
|
[Token(Token = "0x17001155")]
|
|
public static ClusterLODManager Instance
|
|
{
|
|
[Token(Token = "0x6006B26")]
|
|
[Address(RVA = "0x1464250", Offset = "0x1463050", VA = "0x181464250")]
|
|
get
|
|
{
|
|
return ClusterLODManager._instance;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B27 RID: 27431 RVA: 0x0017BE90 File Offset: 0x0017A090
|
|
[Token(Token = "0x6006B27")]
|
|
[Address(RVA = "0x1462940", Offset = "0x1461740", VA = "0x181462940")]
|
|
private void OnDestroy()
|
|
{
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = this.ClusterMeshAssetCache.createMeshFromClusterJob;
|
|
JobHandle <jobHandle>k__BackingField = createMeshFromClusterJob.<jobHandle>k__BackingField;
|
|
createMeshFromClusterJob.sharedResultMesh.Dispose();
|
|
createMeshFromClusterJob.optimizationData.Dispose();
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
if (NetworkedSingletonMonoBehaviour.ONCPNMDGGKG)
|
|
{
|
|
RoomPersistenceManager instance = NetworkedSingletonMonoBehaviour.ONCPNMDGGKG;
|
|
Action action = new Action(this.OnRoomStartLoad);
|
|
instance.OEEEEIDBCDJ -= action;
|
|
RoomPersistenceManager instance2 = NetworkedSingletonMonoBehaviour.ONCPNMDGGKG;
|
|
Action action2 = new Action(this.OnRoomStartLoad);
|
|
instance2.NNKFGEALMHJ -= action2;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B28 RID: 27432 RVA: 0x0017BF18 File Offset: 0x0017A118
|
|
[Token(Token = "0x6006B28")]
|
|
[Address(RVA = "0x14632A0", Offset = "0x14620A0", VA = "0x1814632A0")]
|
|
public static void SetSpawnPosition(Vector3 spawnPos)
|
|
{
|
|
ClusterLODManager instance = ClusterLODManager._instance;
|
|
int num = 0;
|
|
if (instance != num)
|
|
{
|
|
ClusterLODManager instance2 = ClusterLODManager._instance;
|
|
float z = spawnPos.z;
|
|
instance2.<EyePos>k__BackingField.z = z;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001156 RID: 4438
|
|
// (get) Token: 0x06006B29 RID: 27433 RVA: 0x0017BF58 File Offset: 0x0017A158
|
|
[Token(Token = "0x17001156")]
|
|
public static bool WorldCreated
|
|
{
|
|
[Token(Token = "0x6006B29")]
|
|
[Address(RVA = "0x1464310", Offset = "0x1463110", VA = "0x181464310")]
|
|
get
|
|
{
|
|
ClusterLODManager instance = ClusterLODManager._instance;
|
|
int num = 0;
|
|
return instance == num || ClusterLODManager._instance.CurrentState == ClusterLODManager.State.Running;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001157 RID: 4439
|
|
// (get) Token: 0x06006B2A RID: 27434 RVA: 0x0017BF8C File Offset: 0x0017A18C
|
|
[Token(Token = "0x17001157")]
|
|
public static bool ComponentCollectionEnabled
|
|
{
|
|
[Token(Token = "0x6006B2A")]
|
|
[Address(RVA = "0x1464140", Offset = "0x1462F40", VA = "0x181464140")]
|
|
get
|
|
{
|
|
ClusterLODManager instance = ClusterLODManager._instance;
|
|
int num = 0;
|
|
bool flag = instance != num;
|
|
if (!flag)
|
|
{
|
|
return flag;
|
|
}
|
|
return ClusterLODManager._instance.CurrentState == ClusterLODManager.State.Waiting || ClusterLODManager._instance.CurrentState == ClusterLODManager.State.Collecting;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B2B RID: 27435 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6006B2B")]
|
|
[Address(RVA = "0x1461D70", Offset = "0x1460B70", VA = "0x181461D70")]
|
|
private void Awake()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06006B2C RID: 27436 RVA: 0x0017BFD4 File Offset: 0x0017A1D4
|
|
[Token(Token = "0x6006B2C")]
|
|
[Address(RVA = "0x1463950", Offset = "0x1462750", VA = "0x181463950")]
|
|
private void StopCreateWorld()
|
|
{
|
|
Coroutine coroutine = this.createWorldCoroutine;
|
|
if (coroutine != 0)
|
|
{
|
|
base.StopCoroutine(coroutine);
|
|
this.createWorldCoroutine = (ulong)0L;
|
|
}
|
|
Coroutine coroutine2 = this.assignLODsCoroutine;
|
|
if (coroutine2 != 0)
|
|
{
|
|
base.StopCoroutine(coroutine2);
|
|
this.assignLODsCoroutine = (ulong)0L;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B2D RID: 27437 RVA: 0x0017C018 File Offset: 0x0017A218
|
|
[Token(Token = "0x6006B2D")]
|
|
[Address(RVA = "0x1462B70", Offset = "0x1461970", VA = "0x181462B70")]
|
|
private void OnRoomStartLoad()
|
|
{
|
|
ClusterMeshAssetCache clusterMeshAssetCache = this.ClusterMeshAssetCache;
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = clusterMeshAssetCache.createMeshFromClusterJob;
|
|
JobHandle <jobHandle>k__BackingField = createMeshFromClusterJob.<jobHandle>k__BackingField;
|
|
int num = 0;
|
|
createMeshFromClusterJob.<cluster>k__BackingField = num;
|
|
clusterMeshAssetCache.createQueue.Clear();
|
|
OMCHJHPFBDN.KGFPNIMJHIC(this.detailRoot);
|
|
OMCHJHPFBDN.KGFPNIMJHIC(this.worldRoot);
|
|
GameObject gameObject = new GameObject("DetailRoot");
|
|
this.detailRoot = gameObject;
|
|
Transform transform = gameObject.transform;
|
|
Transform transform2 = base.transform;
|
|
transform.parent = transform2;
|
|
GameObject gameObject2 = new GameObject("WorldRoot");
|
|
this.worldRoot = gameObject2;
|
|
Transform transform3 = gameObject2.transform;
|
|
Transform transform4 = base.transform;
|
|
transform3.parent = transform4;
|
|
this.worldClusterMeshRenderers[num].Clear();
|
|
this.clusterInfos[num].Clear();
|
|
num++;
|
|
this.newAddedStaticComponents.Clear();
|
|
this.newAddedWorldComponents.Clear();
|
|
this.newAddedDetailComponents.Clear();
|
|
this.newShapeContainers.Clear();
|
|
Coroutine coroutine = this.createWorldCoroutine;
|
|
if (coroutine != 0)
|
|
{
|
|
base.StopCoroutine(coroutine);
|
|
this.createWorldCoroutine = num;
|
|
}
|
|
Coroutine coroutine2 = this.assignLODsCoroutine;
|
|
if (coroutine2 != 0)
|
|
{
|
|
base.StopCoroutine(coroutine2);
|
|
this.assignLODsCoroutine = num;
|
|
}
|
|
this.CurrentState = (ClusterLODManager.State)num;
|
|
ClusterLODManager.<CreateWorld>d__41 <CreateWorld>d__;
|
|
<CreateWorld>d__.System.IDisposable.Dispose();
|
|
<CreateWorld>d__.<>1__state = num;
|
|
<CreateWorld>d__.<>4__this = this;
|
|
Coroutine coroutine3 = base.StartCoroutine(<CreateWorld>d__);
|
|
this.createWorldCoroutine = coroutine3;
|
|
}
|
|
|
|
// Token: 0x06006B2E RID: 27438 RVA: 0x0017C180 File Offset: 0x0017A380
|
|
[Token(Token = "0x6006B2E")]
|
|
[Address(RVA = "0x1463570", Offset = "0x1462370", VA = "0x181463570")]
|
|
private void Start()
|
|
{
|
|
Transform transform = base.transform;
|
|
float z = Vector3.zero.z;
|
|
Transform transform2 = base.transform;
|
|
Quaternion identity = Quaternion.identity;
|
|
GameObject gameObject = new GameObject("DetailRoot");
|
|
this.detailRoot = gameObject;
|
|
Transform transform3 = gameObject.transform;
|
|
Transform transform4 = base.transform;
|
|
transform3.parent = transform4;
|
|
GameObject gameObject2 = new GameObject("WorldRoot");
|
|
this.worldRoot = gameObject2;
|
|
Transform transform5 = gameObject2.transform;
|
|
Transform transform6 = base.transform;
|
|
transform5.parent = transform6;
|
|
int num = 0;
|
|
List<ClusterMeshRenderer>[] array = this.worldClusterMeshRenderers;
|
|
List<ClusterMeshRenderer> list = new List();
|
|
if (list != 0)
|
|
{
|
|
}
|
|
array[0] = list;
|
|
List<ClusterMesh.ClusterInfo>[] array2 = this.clusterInfos;
|
|
List<ClusterMesh.ClusterInfo> list2 = new List();
|
|
if (list2 != 0)
|
|
{
|
|
}
|
|
num++;
|
|
array2[0] = list2;
|
|
RoomPersistenceManager instance = NetworkedSingletonMonoBehaviour.ONCPNMDGGKG;
|
|
Action action = new Action(this.OnRoomStartLoad);
|
|
instance.OEEEEIDBCDJ += action;
|
|
RoomPersistenceManager instance2 = NetworkedSingletonMonoBehaviour.ONCPNMDGGKG;
|
|
Action action2 = new Action(this.OnRoomStartLoad);
|
|
instance2.NNKFGEALMHJ += action2;
|
|
ClusterLODManager.<CreateWorld>d__41 <CreateWorld>d__;
|
|
<CreateWorld>d__.System.IDisposable.Dispose();
|
|
<CreateWorld>d__.<>1__state = (int)((ulong)0L);
|
|
<CreateWorld>d__.<>4__this = this;
|
|
Coroutine coroutine = base.StartCoroutine(<CreateWorld>d__);
|
|
this.createWorldCoroutine = coroutine;
|
|
}
|
|
|
|
// Token: 0x06006B2F RID: 27439 RVA: 0x0017C2BC File Offset: 0x0017A4BC
|
|
[Token(Token = "0x6006B2F")]
|
|
[Address(RVA = "0x1463F00", Offset = "0x1462D00", VA = "0x181463F00")]
|
|
private void Update()
|
|
{
|
|
if (this.CurrentState == ClusterLODManager.State.Running)
|
|
{
|
|
this.UpdateLODs();
|
|
bool flag = this.ClusterMeshAssetCache.Update();
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B30 RID: 27440 RVA: 0x0017C2EC File Offset: 0x0017A4EC
|
|
[Token(Token = "0x6006B30")]
|
|
[Address(RVA = "0x1461F60", Offset = "0x1460D60", VA = "0x181461F60")]
|
|
private IEnumerator CreateWorld()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06006B30)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.IEnumerator ClusterLOD.ClusterLODManager::CreateWorld()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
call:void('<CreateWorld>d__41'::System.IDisposable.Dispose, ldloc:'<CreateWorld>d__41'(var_0))
|
|
stfld:int32('<CreateWorld>d__41'::<>1__state, ldloc:'<CreateWorld>d__41'(var_0), conv.u8:uint64[exp:int32](ldc.i8:int64[exp:uint64](0)))
|
|
stfld:ClusterLODManager('<CreateWorld>d__41'::<>4__this, ldloc:'<CreateWorld>d__41'(var_0), ldloc:ClusterLODManager(this))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06006B31 RID: 27441 RVA: 0x0017C310 File Offset: 0x0017A510
|
|
[Token(Token = "0x6006B31")]
|
|
[Address(RVA = "0x1462710", Offset = "0x1461510", VA = "0x181462710")]
|
|
public int GetDetailFromHalfSize(bool near, Vector3 halfSize)
|
|
{
|
|
ClusterLODConfig clusterLODConfig = this.<Config>k__BackingField;
|
|
if (near)
|
|
{
|
|
}
|
|
ClusterLODConfig.LODSettings far = clusterLODConfig.far;
|
|
float useHighestDetailAtGreaterRadius = far.useHighestDetailAtGreaterRadius;
|
|
int num = 0;
|
|
float useLowestDetailAtSmallerRadius = far.useLowestDetailAtSmallerRadius;
|
|
return num + 1;
|
|
}
|
|
|
|
// Token: 0x06006B32 RID: 27442 RVA: 0x0017C34C File Offset: 0x0017A54C
|
|
[Token(Token = "0x6006B32")]
|
|
[Address(RVA = "0x1463B70", Offset = "0x1462970", VA = "0x181463B70")]
|
|
public void UpdateLODs()
|
|
{
|
|
List<ClusterMeshRenderer>[] array = this.worldClusterMeshRenderers;
|
|
int num = 0;
|
|
int num2 = 0;
|
|
List<ClusterMeshRenderer> list = array[num2];
|
|
num2++;
|
|
uint num3;
|
|
if (num != 0 && num3 > (uint)0)
|
|
{
|
|
int num4 = this.clusterIndex;
|
|
num4++;
|
|
List<ClusterMeshRenderer>[] array2 = this.worldClusterMeshRenderers;
|
|
int num5 = 0;
|
|
this.clusterIndex = num2;
|
|
int size = array2[num5]._size;
|
|
num2 -= size;
|
|
num5++;
|
|
if (num5 < 3)
|
|
{
|
|
bool flag;
|
|
bool flag2;
|
|
if (flag || !flag2)
|
|
{
|
|
bool flag3;
|
|
if (flag3)
|
|
{
|
|
GameObject gameObject;
|
|
global::UnityEngine.Object.Destroy(gameObject);
|
|
}
|
|
List<ClusterMeshRenderer>[] array3 = this.worldClusterMeshRenderers;
|
|
List<ClusterMeshRenderer> list2;
|
|
while (list2 != 0)
|
|
{
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
if (array2[0] != 0)
|
|
{
|
|
uint num6;
|
|
int num7;
|
|
num6 -= (uint)num7;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006B33 RID: 27443 RVA: 0x0017C3F8 File Offset: 0x0017A5F8
|
|
[Token(Token = "0x6006B33")]
|
|
[Address(RVA = "0x1461C90", Offset = "0x1460A90", VA = "0x181461C90")]
|
|
public void AddClusterMeshRenderers(List<ClusterMeshRenderer> newClusters, ClusterLODManager.RenderLayer layer)
|
|
{
|
|
this.worldClusterMeshRenderers[(int)layer].AddRange(newClusters);
|
|
}
|
|
|
|
// Token: 0x06006B34 RID: 27444 RVA: 0x0017C420 File Offset: 0x0017A620
|
|
[Token(Token = "0x6006B34")]
|
|
[Address(RVA = "0x1461FC0", Offset = "0x1460DC0", VA = "0x181461FC0")]
|
|
public List<ClusterMeshRenderer> GenerateMeshRenderers(List<IClusterLODComponent> components, Transform root, ClusterLODManager.RenderLayer layer, bool dynamic)
|
|
{
|
|
List<ClusterMeshRenderer> list;
|
|
int num7;
|
|
do
|
|
{
|
|
list = new List();
|
|
ClusterLODConfig clusterLODConfig = this.<Config>k__BackingField;
|
|
ClusterLODConfig.LODSettings near = clusterLODConfig.near;
|
|
int maxNumVertsInCluster = near.maxNumVertsInCluster;
|
|
float maxRadiusOfCluster = near.maxRadiusOfCluster;
|
|
int minNumObjectPerCluster = clusterLODConfig.minNumObjectPerCluster;
|
|
float distributeVSminimize = clusterLODConfig.distributeVSminimize;
|
|
ClusterTreeGenerator clusterTreeGenerator;
|
|
clusterTreeGenerator.minNumVerts = clusterTreeGenerator;
|
|
clusterTreeGenerator.maxNumVerts = maxNumVertsInCluster;
|
|
clusterTreeGenerator.maxRadius = maxRadiusOfCluster;
|
|
clusterTreeGenerator.minNumObjectPerCluster = minNumObjectPerCluster;
|
|
clusterTreeGenerator.distributeVSminimize = distributeVSminimize;
|
|
ClusterNode clusterNode;
|
|
clusterNode.parent = (ulong)0L;
|
|
clusterNode.components = components;
|
|
int num = 0;
|
|
int num2 = 0;
|
|
int vertexCount = ClusterUtil.GetVertexCount(components, (NPBPPKDLKDN)num2);
|
|
clusterNode.vertexCount = vertexCount;
|
|
List<ClusterNode> list2 = new List();
|
|
ClusterTree clusterTree;
|
|
clusterTree.Nodes = list2;
|
|
int num3 = 0;
|
|
clusterTree.FieldGetter(num3, num, layer);
|
|
clusterTree.<Root>k__BackingField = num3;
|
|
clusterTree.Nodes.Add(num3);
|
|
clusterTreeGenerator.<Tree>k__BackingField = clusterTree;
|
|
Stack<ClusterNode> stack = new Stack();
|
|
clusterTreeGenerator.unProcessedClusters = stack;
|
|
ClusterNode <Root>k__BackingField = clusterTreeGenerator.<Tree>k__BackingField.<Root>k__BackingField;
|
|
stack.Push(<Root>k__BackingField);
|
|
ClusterNode clusterNode2 = clusterTreeGenerator.unProcessedClusters.Pop();
|
|
int num4 = 0;
|
|
bool flag = clusterTreeGenerator.SplitCluster(clusterNode2);
|
|
Stack<ClusterNode> unProcessedClusters = clusterTreeGenerator.unProcessedClusters;
|
|
ClusterLODConfig.LODSettings far = this.<Config>k__BackingField.far;
|
|
int minNumVertsInCluster = far.minNumVertsInCluster;
|
|
int maxNumVertsInCluster2 = far.maxNumVertsInCluster;
|
|
float maxRadiusOfCluster2 = far.maxRadiusOfCluster;
|
|
int num5 = 0;
|
|
ClusterMeshGenerator clusterMeshGenerator;
|
|
clusterMeshGenerator.FieldGetter(num5, num4, layer);
|
|
clusterMeshGenerator.minNumVerts = minNumVertsInCluster;
|
|
clusterMeshGenerator.maxNumVerts = maxNumVertsInCluster2;
|
|
clusterMeshGenerator.maxDiameterSq = maxRadiusOfCluster2;
|
|
ClusterTree <Tree>k__BackingField = clusterTreeGenerator.<Tree>k__BackingField;
|
|
List<ClusterMesh> list3 = new List();
|
|
clusterMeshGenerator.<Meshes>k__BackingField = list3;
|
|
ClusterNode <Root>k__BackingField2 = <Tree>k__BackingField.<Root>k__BackingField;
|
|
int num6 = clusterMeshGenerator.UpdateVertexCount(<Root>k__BackingField2);
|
|
ClusterNode <Root>k__BackingField3 = <Tree>k__BackingField.<Root>k__BackingField;
|
|
clusterMeshGenerator.CreateClusterMeshInstances(<Root>k__BackingField3);
|
|
List<ClusterMesh> <Meshes>k__BackingField = clusterMeshGenerator.<Meshes>k__BackingField;
|
|
num7 = 0;
|
|
bool flag2;
|
|
if (flag2)
|
|
{
|
|
ClusterMeshRenderer clusterMeshRenderer = this.clusterMeshRendererPrefab;
|
|
MeshFilter meshFilter = this.clusterPrefab;
|
|
ClusterMeshRenderer clusterMeshRenderer2;
|
|
MeshRenderer component = clusterMeshRenderer2.GetComponent<MeshRenderer>();
|
|
Material meshMaterial = ClusterLODManager._instance.GetMeshMaterial();
|
|
component.SetMaterial(meshMaterial);
|
|
clusterMeshRenderer2.<Dynamic>k__BackingField = meshMaterial != null;
|
|
clusterMeshRenderer2.Init(num7, meshFilter);
|
|
clusterMeshRenderer2.GenerateLOD();
|
|
bool flag3;
|
|
if (flag3)
|
|
{
|
|
}
|
|
if (num7 != 0)
|
|
{
|
|
goto IL_221;
|
|
}
|
|
while ((ulong)((uint)(-1)) == (ulong)(-1L))
|
|
{
|
|
}
|
|
}
|
|
}
|
|
while (num7 != 0);
|
|
return list;
|
|
IL_221:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006B35 RID: 27445 RVA: 0x0017C674 File Offset: 0x0017A874
|
|
[Token(Token = "0x6006B35")]
|
|
[Address(RVA = "0x1462900", Offset = "0x1461700", VA = "0x181462900")]
|
|
public ClusterLODManager.RenderLayer GetRenderLayer(Vector3 extents)
|
|
{
|
|
float sqrMagnitude = extents.sqrMagnitude;
|
|
float maxRadiusForDetailObjects = this.<Config>k__BackingField.maxRadiusForDetailObjects;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006B36 RID: 27446 RVA: 0x0017C69C File Offset: 0x0017A89C
|
|
[Token(Token = "0x6006B36")]
|
|
[Address(RVA = "0x1462EF0", Offset = "0x1461CF0", VA = "0x181462EF0")]
|
|
public void RegisterShapeContainer(ShapeContainer newShapeContainer)
|
|
{
|
|
this.newShapeContainers.Add(newShapeContainer);
|
|
}
|
|
|
|
// Token: 0x06006B37 RID: 27447 RVA: 0x0017C6BC File Offset: 0x0017A8BC
|
|
[Token(Token = "0x6006B37")]
|
|
[Address(RVA = "0x14639A0", Offset = "0x14627A0", VA = "0x1814639A0")]
|
|
public bool TryDeRegisterShapeContainer(ShapeContainer newShapeContainer)
|
|
{
|
|
return this.newShapeContainers.Remove(newShapeContainer);
|
|
}
|
|
|
|
// Token: 0x06006B38 RID: 27448 RVA: 0x0017C6DC File Offset: 0x0017A8DC
|
|
[Token(Token = "0x6006B38")]
|
|
[Address(RVA = "0x1462E90", Offset = "0x1461C90", VA = "0x181462E90")]
|
|
public void RegisterComponent(IClusterLODComponent newComponent)
|
|
{
|
|
this.newAddedStaticComponents.Add(newComponent);
|
|
}
|
|
|
|
// Token: 0x06006B39 RID: 27449 RVA: 0x0017C6FC File Offset: 0x0017A8FC
|
|
[Token(Token = "0x6006B39")]
|
|
[Address(RVA = "0x1461C00", Offset = "0x1460A00", VA = "0x181461C00")]
|
|
private void AddClusterMeshClusterInfo(ClusterMesh.ClusterInfo info, int layer)
|
|
{
|
|
this.clusterInfos[layer].Add(info);
|
|
}
|
|
|
|
// Token: 0x06006B3A RID: 27450 RVA: 0x0017C724 File Offset: 0x0017A924
|
|
[Token(Token = "0x6006B3A")]
|
|
[Address(RVA = "0x1462F50", Offset = "0x1461D50", VA = "0x181462F50")]
|
|
public void RemoveClusterMeshClusterInfo(ClusterMesh.ClusterInfo info)
|
|
{
|
|
int num = 0;
|
|
int num2 = this.clusterInfos[num].IndexOf(info);
|
|
this.clusterInfos[num].RemoveAt(num2);
|
|
num++;
|
|
}
|
|
|
|
// Token: 0x06006B3B RID: 27451 RVA: 0x0017C764 File Offset: 0x0017A964
|
|
[Token(Token = "0x6006B3B")]
|
|
[Address(RVA = "0x1463450", Offset = "0x1462250", VA = "0x181463450")]
|
|
private void SortClusterInfos(Vector3 pos, ClusterLODManager.RenderLayer layer)
|
|
{
|
|
List<ClusterMesh.ClusterInfo> list = this.clusterInfos[(int)layer];
|
|
Comparison<ClusterMesh.ClusterInfo> <>9__53_ = ClusterLODManager.<>c.<>9__53_0;
|
|
if (<>9__53_ == 0)
|
|
{
|
|
ClusterLODManager.<>c.<>9__53_0 = delegate(ClusterMesh.ClusterInfo a, ClusterMesh.ClusterInfo b)
|
|
{
|
|
int num;
|
|
return num;
|
|
};
|
|
}
|
|
list.Sort(<>9__53_);
|
|
}
|
|
|
|
// Token: 0x06006B3C RID: 27452 RVA: 0x0017C7AC File Offset: 0x0017A9AC
|
|
[Token(Token = "0x6006B3C")]
|
|
[Address(RVA = "0x1463A00", Offset = "0x1462800", VA = "0x181463A00")]
|
|
private void UpdateClusterDistances(Vector3 pos, ClusterLODManager.RenderLayer layer)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
List<ClusterMeshRenderer> list = this.worldClusterMeshRenderers[(int)layer];
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x06006B3D RID: 27453 RVA: 0x0017C7E0 File Offset: 0x0017A9E0
|
|
[Token(Token = "0x6006B3D")]
|
|
[Address(RVA = "0x1461D10", Offset = "0x1460B10", VA = "0x181461D10")]
|
|
private IEnumerator AssignLODs()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06006B3D)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.IEnumerator ClusterLOD.ClusterLODManager::AssignLODs()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
call:void('<AssignLODs>d__55'::System.IDisposable.Dispose, ldloc:'<AssignLODs>d__55'(var_0))
|
|
stfld:int32('<AssignLODs>d__55'::<>1__state, ldloc:'<AssignLODs>d__55'(var_0), conv.u8:uint64[exp:int32](ldc.i8:int64[exp:uint64](0)))
|
|
stfld:ClusterLODManager('<AssignLODs>d__55'::<>4__this, ldloc:'<AssignLODs>d__55'(var_0), ldloc:ClusterLODManager(this))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06006B3E RID: 27454 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6006B3E")]
|
|
[Address(RVA = "0x1463E00", Offset = "0x1462C00", VA = "0x181463E00")]
|
|
private int UpdateLodRequest(int index, int budget, List<ClusterMesh.ClusterInfo> clusters, byte lod, ref int numVertsToSpare, float minDist = 0f)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06006B3F RID: 27455 RVA: 0x0017C804 File Offset: 0x0017AA04
|
|
[Token(Token = "0x6006B3F")]
|
|
[Address(RVA = "0x1463030", Offset = "0x1461E30", VA = "0x181463030")]
|
|
public void Remove(IClusterLODComponent component)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (num >= 3)
|
|
{
|
|
return;
|
|
}
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
bool flag2;
|
|
while (!flag2)
|
|
{
|
|
}
|
|
bool flag3;
|
|
while (!flag3)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
while (num != 0);
|
|
if ((ulong)((uint)(-1)) != (ulong)(-1L))
|
|
{
|
|
}
|
|
num++;
|
|
}
|
|
|
|
// Token: 0x06006B40 RID: 27456 RVA: 0x0017C854 File Offset: 0x0017AA54
|
|
[Token(Token = "0x6006B40")]
|
|
[Address(RVA = "0x1463410", Offset = "0x1462210", VA = "0x181463410")]
|
|
public bool ShouldUpdateDetailMeshes()
|
|
{
|
|
ClusterLODConfig.LODSettings near = this.<Config>k__BackingField.near;
|
|
float maxSubDivideEdgeSize = near.maxSubDivideEdgeSize;
|
|
int num = 0;
|
|
if (maxSubDivideEdgeSize <= (float)num)
|
|
{
|
|
}
|
|
float maxSubDivideDistance = near.maxSubDivideDistance;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006B41 RID: 27457 RVA: 0x0017C88C File Offset: 0x0017AA8C
|
|
[Token(Token = "0x6006B41")]
|
|
[Address(RVA = "0x1462E80", Offset = "0x1461C80", VA = "0x181462E80")]
|
|
public void RegisterAdditionalVertsChange(int change)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06006B42 RID: 27458 RVA: 0x0017C89C File Offset: 0x0017AA9C
|
|
[Token(Token = "0x6006B42")]
|
|
[Address(RVA = "0x1462860", Offset = "0x1461660", VA = "0x181462860")]
|
|
public Material GetMeshMaterial()
|
|
{
|
|
Material material = this.sharedMeshMaterial;
|
|
int num = 0;
|
|
if (material == num)
|
|
{
|
|
Material material2 = EOKPFJPCGMK.OAEGHKNCLCN(ACBDPBHGKJL.Box);
|
|
this.sharedMeshMaterial = material2;
|
|
}
|
|
return this.sharedMeshMaterial;
|
|
}
|
|
|
|
// Token: 0x06006B43 RID: 27459 RVA: 0x0017C8D0 File Offset: 0x0017AAD0
|
|
[Token(Token = "0x6006B43")]
|
|
[Address(RVA = "0x1462820", Offset = "0x1461620", VA = "0x181462820")]
|
|
public int GetMaxNumActiveLOD0Verts()
|
|
{
|
|
return this.<Config>k__BackingField.maxDynamicNearVerts;
|
|
}
|
|
|
|
// Token: 0x06006B44 RID: 27460 RVA: 0x0017C8F0 File Offset: 0x0017AAF0
|
|
[Token(Token = "0x6006B44")]
|
|
[Address(RVA = "0x1463F40", Offset = "0x1462D40", VA = "0x181463F40")]
|
|
public ClusterLODManager()
|
|
{
|
|
ClusterMeshAssetCache clusterMeshAssetCache = new ClusterMeshAssetCache();
|
|
Queue<ClusterMesh.ClusterInfo> queue = new Queue();
|
|
clusterMeshAssetCache.createQueue = queue;
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = new CreateMeshFromClusterJob();
|
|
PCIKHFEIHGO pcikhfeihgo = new PCIKHFEIHGO();
|
|
createMeshFromClusterJob.sharedResultMesh = pcikhfeihgo;
|
|
OCCMLFOBCEM occmlfobcem = new OCCMLFOBCEM();
|
|
createMeshFromClusterJob.optimizationData = occmlfobcem;
|
|
clusterMeshAssetCache.createMeshFromClusterJob = createMeshFromClusterJob;
|
|
List<ClusterMesh.ClusterInfo> list = new List();
|
|
clusterMeshAssetCache.activeClusters = list;
|
|
this.ClusterMeshAssetCache = clusterMeshAssetCache;
|
|
List<IClusterLODComponent> list2 = new List();
|
|
this.newAddedStaticComponents = list2;
|
|
List<IClusterLODComponent> list3 = new List();
|
|
this.newAddedWorldComponents = list3;
|
|
List<IClusterLODComponent> list4 = new List();
|
|
this.newAddedDetailComponents = list4;
|
|
List<ClusterMeshRenderer>[] array = new List<ClusterMeshRenderer>[3];
|
|
this.worldClusterMeshRenderers = array;
|
|
List<ClusterMesh.ClusterInfo>[] array2 = new List<ClusterMesh.ClusterInfo>[3];
|
|
this.clusterInfos = array2;
|
|
List<ShapeContainer> list5 = new List();
|
|
this.newShapeContainers = list5;
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x06006B45 RID: 27461 RVA: 0x0000220F File Offset: 0x0000040F
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x6006B45")]
|
|
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080")]
|
|
static ClusterLODManager()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x04004789 RID: 18313
|
|
[Token(Token = "0x4004789")]
|
|
public const int NUM_RENDER_LAYERS = 3;
|
|
|
|
// Token: 0x0400478B RID: 18315
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400478B")]
|
|
public ClusterMeshRenderer clusterMeshRendererPrefab;
|
|
|
|
// Token: 0x0400478C RID: 18316
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400478C")]
|
|
public MeshFilter clusterPrefab;
|
|
|
|
// Token: 0x0400478D RID: 18317
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400478D")]
|
|
private GameObject detailRoot;
|
|
|
|
// Token: 0x0400478E RID: 18318
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400478E")]
|
|
private GameObject worldRoot;
|
|
|
|
// Token: 0x0400478F RID: 18319
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x400478F")]
|
|
public ClusterMeshAssetCache ClusterMeshAssetCache;
|
|
|
|
// Token: 0x04004790 RID: 18320
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4004790")]
|
|
public List<IClusterLODComponent> newAddedStaticComponents;
|
|
|
|
// Token: 0x04004791 RID: 18321
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4004791")]
|
|
public List<IClusterLODComponent> newAddedWorldComponents;
|
|
|
|
// Token: 0x04004792 RID: 18322
|
|
[FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x4004792")]
|
|
public List<IClusterLODComponent> newAddedDetailComponents;
|
|
|
|
// Token: 0x04004793 RID: 18323
|
|
[FieldOffset(Offset = "0x60")]
|
|
[Token(Token = "0x4004793")]
|
|
private int clusterIndex;
|
|
|
|
// Token: 0x04004795 RID: 18325
|
|
[FieldOffset(Offset = "0x70")]
|
|
[Token(Token = "0x4004795")]
|
|
public ClusterLODManager.State CurrentState;
|
|
|
|
// Token: 0x04004796 RID: 18326
|
|
[FieldOffset(Offset = "0x78")]
|
|
[Token(Token = "0x4004796")]
|
|
public List<ClusterMeshRenderer>[] worldClusterMeshRenderers;
|
|
|
|
// Token: 0x04004797 RID: 18327
|
|
[FieldOffset(Offset = "0x80")]
|
|
[Token(Token = "0x4004797")]
|
|
private List<ClusterMesh.ClusterInfo>[] clusterInfos;
|
|
|
|
// Token: 0x04004798 RID: 18328
|
|
[FieldOffset(Offset = "0x88")]
|
|
[Token(Token = "0x4004798")]
|
|
private Coroutine createWorldCoroutine;
|
|
|
|
// Token: 0x04004799 RID: 18329
|
|
[FieldOffset(Offset = "0x90")]
|
|
[Token(Token = "0x4004799")]
|
|
private Coroutine assignLODsCoroutine;
|
|
|
|
// Token: 0x0400479A RID: 18330
|
|
[FieldOffset(Offset = "0x98")]
|
|
[Token(Token = "0x400479A")]
|
|
public int estimatedNumWorldLODVerts;
|
|
|
|
// Token: 0x0400479B RID: 18331
|
|
[FieldOffset(Offset = "0x9C")]
|
|
[Token(Token = "0x400479B")]
|
|
public int numWorldLODVerts;
|
|
|
|
// Token: 0x0400479C RID: 18332
|
|
[Token(Token = "0x400479C")]
|
|
private static ClusterLODManager _instance;
|
|
|
|
// Token: 0x0400479D RID: 18333
|
|
[FieldOffset(Offset = "0xA0")]
|
|
[Token(Token = "0x400479D")]
|
|
private List<ShapeContainer> newShapeContainers;
|
|
|
|
// Token: 0x0400479E RID: 18334
|
|
[FieldOffset(Offset = "0xA8")]
|
|
[Token(Token = "0x400479E")]
|
|
public int numAdditionalVerts;
|
|
|
|
// Token: 0x0400479F RID: 18335
|
|
[FieldOffset(Offset = "0xB0")]
|
|
[Token(Token = "0x400479F")]
|
|
private Material sharedMeshMaterial;
|
|
|
|
// Token: 0x02001273 RID: 4723
|
|
[Token(Token = "0x2001273")]
|
|
public enum RenderLayer
|
|
{
|
|
// Token: 0x040047A1 RID: 18337
|
|
[Token(Token = "0x40047A1")]
|
|
World,
|
|
// Token: 0x040047A2 RID: 18338
|
|
[Token(Token = "0x40047A2")]
|
|
Detail,
|
|
// Token: 0x040047A3 RID: 18339
|
|
[Token(Token = "0x40047A3")]
|
|
Dynamic,
|
|
// Token: 0x040047A4 RID: 18340
|
|
[Token(Token = "0x40047A4")]
|
|
NumLayers
|
|
}
|
|
|
|
// Token: 0x02001274 RID: 4724
|
|
[Token(Token = "0x2001274")]
|
|
public enum State
|
|
{
|
|
// Token: 0x040047A6 RID: 18342
|
|
[Token(Token = "0x40047A6")]
|
|
Waiting,
|
|
// Token: 0x040047A7 RID: 18343
|
|
[Token(Token = "0x40047A7")]
|
|
Collecting,
|
|
// Token: 0x040047A8 RID: 18344
|
|
[Token(Token = "0x40047A8")]
|
|
Generating,
|
|
// Token: 0x040047A9 RID: 18345
|
|
[Token(Token = "0x40047A9")]
|
|
Running
|
|
}
|
|
}
|
|
}
|