237 lines
8.1 KiB
C#
237 lines
8.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Cpp2IlInjected;
|
|
using Unity.Jobs;
|
|
using UnityEngine;
|
|
|
|
namespace ClusterLOD
|
|
{
|
|
// Token: 0x0200134F RID: 4943
|
|
[Token(Token = "0x200134F")]
|
|
public class ClusterMeshAssetCache : IDisposable
|
|
{
|
|
// Token: 0x06006EF8 RID: 28408 RVA: 0x00185EC0 File Offset: 0x001840C0
|
|
[Token(Token = "0x6006EF8")]
|
|
[Address(RVA = "0x1F401C0", Offset = "0x1F3F1C0", VA = "0x181F401C0", Slot = "4")]
|
|
public void Dispose()
|
|
{
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = this.createMeshFromClusterJob;
|
|
JobHandle <jobHandle>k__BackingField = createMeshFromClusterJob.<jobHandle>k__BackingField;
|
|
createMeshFromClusterJob.sharedResultMesh.Dispose();
|
|
createMeshFromClusterJob.optimizationData.Dispose();
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006EF9 RID: 28409 RVA: 0x00185EFC File Offset: 0x001840FC
|
|
[Token(Token = "0x6006EF9")]
|
|
[Address(RVA = "0x1F40140", Offset = "0x1F3F140", VA = "0x181F40140")]
|
|
public void Clear()
|
|
{
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = this.createMeshFromClusterJob;
|
|
JobHandle <jobHandle>k__BackingField = createMeshFromClusterJob.<jobHandle>k__BackingField;
|
|
createMeshFromClusterJob.<cluster>k__BackingField = (ulong)0L;
|
|
this.createQueue.Clear();
|
|
}
|
|
|
|
// Token: 0x06006EFA RID: 28410 RVA: 0x00185F34 File Offset: 0x00184134
|
|
[Token(Token = "0x6006EFA")]
|
|
[Address(RVA = "0x1F400A0", Offset = "0x1F3F0A0", VA = "0x181F400A0")]
|
|
public void Add(ClusterMesh.ClusterInfo cluster, Transform root)
|
|
{
|
|
List<IClusterLODComponent> components = cluster.components;
|
|
cluster.root = root;
|
|
if (!this.createQueue.Contains(cluster))
|
|
{
|
|
this.createQueue.Enqueue(cluster);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006EFB RID: 28411 RVA: 0x00185F70 File Offset: 0x00184170
|
|
[Token(Token = "0x6006EFB")]
|
|
[Address(RVA = "0x1F40530", Offset = "0x1F3F530", VA = "0x181F40530")]
|
|
public void Remove(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
if (this.createQueue.Contains(cluster))
|
|
{
|
|
Queue<ClusterMesh.ClusterInfo> queue = new Queue();
|
|
ClusterMesh.ClusterInfo clusterInfo = this.createQueue.Dequeue();
|
|
if (clusterInfo != cluster)
|
|
{
|
|
queue.Enqueue(clusterInfo);
|
|
}
|
|
Queue<ClusterMesh.ClusterInfo> queue2 = this.createQueue;
|
|
this.createQueue = queue;
|
|
}
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = this.createMeshFromClusterJob;
|
|
ClusterMesh.ClusterInfo <cluster>k__BackingField = createMeshFromClusterJob.<cluster>k__BackingField;
|
|
JobHandle <jobHandle>k__BackingField = createMeshFromClusterJob.<jobHandle>k__BackingField;
|
|
createMeshFromClusterJob.<cluster>k__BackingField = (ulong)0L;
|
|
if (this.activeClusters.Contains(cluster))
|
|
{
|
|
bool flag = this.activeClusters.Remove(cluster);
|
|
int numLOD0Verts = cluster.numLOD0Verts;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06006EFC RID: 28412 RVA: 0x00186004 File Offset: 0x00184204
|
|
[Token(Token = "0x6006EFC")]
|
|
[Address(RVA = "0x1F402D0", Offset = "0x1F3F2D0", VA = "0x181F402D0")]
|
|
private ClusterMesh.ClusterInfo GetWorstActiveCluster()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
List<ClusterMesh.ClusterInfo> list = this.activeClusters;
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006EFD RID: 28413 RVA: 0x00186030 File Offset: 0x00184230
|
|
[Token(Token = "0x6006EFD")]
|
|
[Address(RVA = "0x1F40400", Offset = "0x1F3F400", VA = "0x181F40400")]
|
|
private bool IsClusterActive(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
return this.activeClusters.Contains(cluster);
|
|
}
|
|
|
|
// Token: 0x06006EFE RID: 28414 RVA: 0x00186050 File Offset: 0x00184250
|
|
[Token(Token = "0x6006EFE")]
|
|
[Address(RVA = "0x1F404A0", Offset = "0x1F3F4A0", VA = "0x181F404A0")]
|
|
private bool RemoveActiveCluster(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
bool flag = this.activeClusters.Contains(cluster);
|
|
if (!flag)
|
|
{
|
|
return flag;
|
|
}
|
|
bool flag2 = this.activeClusters.Remove(cluster);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006EFF RID: 28415 RVA: 0x00186084 File Offset: 0x00184284
|
|
[Token(Token = "0x6006EFF")]
|
|
[Address(RVA = "0x1F40040", Offset = "0x1F3F040", VA = "0x181F40040")]
|
|
private void AddActiveCluster(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
this.activeClusters.Add(cluster);
|
|
int numLOD0Verts = cluster.numLOD0Verts;
|
|
}
|
|
|
|
// Token: 0x06006F00 RID: 28416 RVA: 0x001860AC File Offset: 0x001842AC
|
|
[Token(Token = "0x6006F00")]
|
|
[Address(RVA = "0x1F40460", Offset = "0x1F3F460", VA = "0x181F40460")]
|
|
public bool IsProcessing(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
ClusterMesh.ClusterInfo <cluster>k__BackingField = this.createMeshFromClusterJob.<cluster>k__BackingField;
|
|
bool flag;
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06006F01 RID: 28417 RVA: 0x001860D0 File Offset: 0x001842D0
|
|
[Token(Token = "0x6006F01")]
|
|
[Address(RVA = "0x1F406C0", Offset = "0x1F3F6C0", VA = "0x181F406C0")]
|
|
public bool Update()
|
|
{
|
|
ClusterMesh.ClusterInfo clusterInfo;
|
|
ClusterMesh.ClusterInfo worstActiveCluster;
|
|
do
|
|
{
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = this.createMeshFromClusterJob;
|
|
if (createMeshFromClusterJob.<cluster>k__BackingField > (ulong)0L)
|
|
{
|
|
if (!JobHandle.ScheduleBatchedJobsAndIsCompleted(createMeshFromClusterJob.<jobHandle>k__BackingField))
|
|
{
|
|
}
|
|
ClusterMesh.ClusterInfo <cluster>k__BackingField = this.createMeshFromClusterJob.<cluster>k__BackingField;
|
|
bool flag = this.RemoveActiveCluster(<cluster>k__BackingField);
|
|
this.createMeshFromClusterJob.CreateMesh();
|
|
this.activeClusters.Add(<cluster>k__BackingField);
|
|
}
|
|
clusterInfo = this.createQueue.Dequeue();
|
|
while (clusterInfo == 0)
|
|
{
|
|
}
|
|
int num = this.numActiveVerts;
|
|
int maxDynamicNearVerts = ClusterLODManager._instance.<Config>k__BackingField.maxDynamicNearVerts;
|
|
if (num <= maxDynamicNearVerts)
|
|
{
|
|
goto IL_B2;
|
|
}
|
|
worstActiveCluster = this.GetWorstActiveCluster();
|
|
if (worstActiveCluster == 0)
|
|
{
|
|
goto IL_B2;
|
|
}
|
|
}
|
|
while (clusterInfo.closestDist > worstActiveCluster.closestDist);
|
|
bool flag2 = this.RemoveActiveCluster(worstActiveCluster);
|
|
worstActiveCluster.RequestRemoveMesh();
|
|
IL_B2:
|
|
CreateMeshFromClusterJob createMeshFromClusterJob2 = this.createMeshFromClusterJob;
|
|
if (createMeshFromClusterJob2.<cluster>k__BackingField <= (ulong)0L)
|
|
{
|
|
List<IClusterLODComponent> components = clusterInfo.components;
|
|
Transform root = clusterInfo.root;
|
|
createMeshFromClusterJob2.Init(clusterInfo, root);
|
|
JobHandle.ScheduleBatchedJobs();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006F02 RID: 28418 RVA: 0x001861D0 File Offset: 0x001843D0
|
|
[Token(Token = "0x6006F02")]
|
|
[Address(RVA = "0x1F40270", Offset = "0x1F3F270", VA = "0x181F40270")]
|
|
private ClusterMesh.ClusterInfo GetClusterToCreate()
|
|
{
|
|
return this.createQueue.Dequeue();
|
|
}
|
|
|
|
// Token: 0x06006F03 RID: 28419 RVA: 0x001861F0 File Offset: 0x001843F0
|
|
[Token(Token = "0x6006F03")]
|
|
[Address(RVA = "0x1F40950", Offset = "0x1F3F950", VA = "0x181F40950")]
|
|
public ClusterMeshAssetCache()
|
|
{
|
|
Queue<ClusterMesh.ClusterInfo> queue = new Queue();
|
|
this.createQueue = queue;
|
|
CreateMeshFromClusterJob createMeshFromClusterJob = new CreateMeshFromClusterJob();
|
|
PCIKHFEIHGO pcikhfeihgo = new PCIKHFEIHGO();
|
|
createMeshFromClusterJob.sharedResultMesh = pcikhfeihgo;
|
|
OCCMLFOBCEM occmlfobcem = new OCCMLFOBCEM();
|
|
createMeshFromClusterJob.optimizationData = occmlfobcem;
|
|
this.createMeshFromClusterJob = createMeshFromClusterJob;
|
|
List<ClusterMesh.ClusterInfo> list = new List();
|
|
this.activeClusters = list;
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x04004971 RID: 18801
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4004971")]
|
|
private Queue<ClusterMesh.ClusterInfo> createQueue;
|
|
|
|
// Token: 0x04004972 RID: 18802
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4004972")]
|
|
private CreateMeshFromClusterJob createMeshFromClusterJob;
|
|
|
|
// Token: 0x04004973 RID: 18803
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4004973")]
|
|
private readonly List<ClusterMesh.ClusterInfo> activeClusters;
|
|
|
|
// Token: 0x04004974 RID: 18804
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4004974")]
|
|
private int numActiveVerts;
|
|
}
|
|
}
|