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: 0x0200127F RID: 4735
|
|
[Token(Token = "0x200127F")]
|
|
public class ClusterMeshAssetCache : IDisposable
|
|
{
|
|
// Token: 0x06006B85 RID: 27525 RVA: 0x0017D920 File Offset: 0x0017BB20
|
|
[Token(Token = "0x6006B85")]
|
|
[Address(RVA = "0x1464D90", Offset = "0x1463B90", VA = "0x181464D90", 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: 0x06006B86 RID: 27526 RVA: 0x0017D95C File Offset: 0x0017BB5C
|
|
[Token(Token = "0x6006B86")]
|
|
[Address(RVA = "0x1464D10", Offset = "0x1463B10", VA = "0x181464D10")]
|
|
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: 0x06006B87 RID: 27527 RVA: 0x0017D994 File Offset: 0x0017BB94
|
|
[Token(Token = "0x6006B87")]
|
|
[Address(RVA = "0x1464C70", Offset = "0x1463A70", VA = "0x181464C70")]
|
|
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: 0x06006B88 RID: 27528 RVA: 0x0017D9D0 File Offset: 0x0017BBD0
|
|
[Token(Token = "0x6006B88")]
|
|
[Address(RVA = "0x1465100", Offset = "0x1463F00", VA = "0x181465100")]
|
|
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: 0x06006B89 RID: 27529 RVA: 0x0017DA64 File Offset: 0x0017BC64
|
|
[Token(Token = "0x6006B89")]
|
|
[Address(RVA = "0x1464EA0", Offset = "0x1463CA0", VA = "0x181464EA0")]
|
|
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: 0x06006B8A RID: 27530 RVA: 0x0017DA90 File Offset: 0x0017BC90
|
|
[Token(Token = "0x6006B8A")]
|
|
[Address(RVA = "0x1464FD0", Offset = "0x1463DD0", VA = "0x181464FD0")]
|
|
private bool IsClusterActive(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
return this.activeClusters.Contains(cluster);
|
|
}
|
|
|
|
// Token: 0x06006B8B RID: 27531 RVA: 0x0017DAB0 File Offset: 0x0017BCB0
|
|
[Token(Token = "0x6006B8B")]
|
|
[Address(RVA = "0x1465070", Offset = "0x1463E70", VA = "0x181465070")]
|
|
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: 0x06006B8C RID: 27532 RVA: 0x0017DAE4 File Offset: 0x0017BCE4
|
|
[Token(Token = "0x6006B8C")]
|
|
[Address(RVA = "0x1464C10", Offset = "0x1463A10", VA = "0x181464C10")]
|
|
private void AddActiveCluster(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
this.activeClusters.Add(cluster);
|
|
int numLOD0Verts = cluster.numLOD0Verts;
|
|
}
|
|
|
|
// Token: 0x06006B8D RID: 27533 RVA: 0x0017DB0C File Offset: 0x0017BD0C
|
|
[Token(Token = "0x6006B8D")]
|
|
[Address(RVA = "0x1465030", Offset = "0x1463E30", VA = "0x181465030")]
|
|
public bool IsProcessing(ClusterMesh.ClusterInfo cluster)
|
|
{
|
|
ClusterMesh.ClusterInfo <cluster>k__BackingField = this.createMeshFromClusterJob.<cluster>k__BackingField;
|
|
bool flag;
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06006B8E RID: 27534 RVA: 0x0017DB30 File Offset: 0x0017BD30
|
|
[Token(Token = "0x6006B8E")]
|
|
[Address(RVA = "0x1465290", Offset = "0x1464090", VA = "0x181465290")]
|
|
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: 0x06006B8F RID: 27535 RVA: 0x0017DC30 File Offset: 0x0017BE30
|
|
[Token(Token = "0x6006B8F")]
|
|
[Address(RVA = "0x1464E40", Offset = "0x1463C40", VA = "0x181464E40")]
|
|
private ClusterMesh.ClusterInfo GetClusterToCreate()
|
|
{
|
|
return this.createQueue.Dequeue();
|
|
}
|
|
|
|
// Token: 0x06006B90 RID: 27536 RVA: 0x0017DC50 File Offset: 0x0017BE50
|
|
[Token(Token = "0x6006B90")]
|
|
[Address(RVA = "0x1465520", Offset = "0x1464320", VA = "0x181465520")]
|
|
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: 0x040047EF RID: 18415
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40047EF")]
|
|
private Queue<ClusterMesh.ClusterInfo> createQueue;
|
|
|
|
// Token: 0x040047F0 RID: 18416
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40047F0")]
|
|
private CreateMeshFromClusterJob createMeshFromClusterJob;
|
|
|
|
// Token: 0x040047F1 RID: 18417
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40047F1")]
|
|
private readonly List<ClusterMesh.ClusterInfo> activeClusters;
|
|
|
|
// Token: 0x040047F2 RID: 18418
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40047F2")]
|
|
private int numActiveVerts;
|
|
}
|
|
}
|