318 lines
9.3 KiB
C#
318 lines
9.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Cpp2IlInjected;
|
|
using UnityEngine;
|
|
|
|
namespace ClusterLOD
|
|
{
|
|
// Token: 0x02001289 RID: 4745
|
|
[Token(Token = "0x2001289")]
|
|
public class ClusterTreeGenerator
|
|
{
|
|
// Token: 0x06006BBA RID: 27578 RVA: 0x0017E538 File Offset: 0x0017C738
|
|
[Token(Token = "0x6006BBA")]
|
|
[Address(RVA = "0x146B3B0", Offset = "0x146A1B0", VA = "0x18146B3B0")]
|
|
public ClusterTreeGenerator(int minNumVerts, int maxNumVerts, float maxRadius, int minNumObjectPerCluster, float distributeVSminimize = 0.5f)
|
|
{
|
|
this.maxRadius = maxRadius;
|
|
this.minNumVerts = minNumVerts;
|
|
this.distributeVSminimize = (float)0;
|
|
this.maxNumVerts = maxNumVerts;
|
|
this.minNumObjectPerCluster = 0;
|
|
}
|
|
|
|
// Token: 0x1700116A RID: 4458
|
|
// (get) Token: 0x06006BBB RID: 27579 RVA: 0x0017E570 File Offset: 0x0017C770
|
|
// (set) Token: 0x06006BBC RID: 27580 RVA: 0x0017E584 File Offset: 0x0017C784
|
|
[Token(Token = "0x1700116A")]
|
|
public ClusterTree Tree
|
|
{
|
|
[Token(Token = "0x6006BBB")]
|
|
[Address(RVA = "0x3F6400", Offset = "0x3F5200", VA = "0x1803F6400")]
|
|
get;
|
|
[Token(Token = "0x6006BBC")]
|
|
[Address(RVA = "0x460F90", Offset = "0x45FD90", VA = "0x180460F90")]
|
|
private set;
|
|
}
|
|
|
|
// Token: 0x06006BBD RID: 27581 RVA: 0x0017E598 File Offset: 0x0017C798
|
|
[Token(Token = "0x6006BBD")]
|
|
[Address(RVA = "0x146A580", Offset = "0x1469380", VA = "0x18146A580")]
|
|
public void InitTree(List<IClusterLODComponent> components)
|
|
{
|
|
int num = 0;
|
|
ClusterNode clusterNode;
|
|
clusterNode.components = components;
|
|
int vertexCount = ClusterUtil.GetVertexCount(components, (NPBPPKDLKDN)num);
|
|
clusterNode.vertexCount = vertexCount;
|
|
List<ClusterNode> list = new List();
|
|
ClusterTree clusterTree;
|
|
clusterTree.Nodes = list;
|
|
List<ClusterNode> nodes = clusterTree.Nodes;
|
|
clusterTree.<Root>k__BackingField = clusterNode;
|
|
nodes.Add(clusterNode);
|
|
this.<Tree>k__BackingField = clusterTree;
|
|
Stack<ClusterNode> stack = new Stack();
|
|
ClusterTree clusterTree2 = this.<Tree>k__BackingField;
|
|
this.unProcessedClusters = stack;
|
|
ClusterNode <Root>k__BackingField = clusterTree2.<Root>k__BackingField;
|
|
stack.Push(<Root>k__BackingField);
|
|
}
|
|
|
|
// Token: 0x06006BBE RID: 27582 RVA: 0x0017E620 File Offset: 0x0017C820
|
|
[Token(Token = "0x6006BBE")]
|
|
[Address(RVA = "0x1469830", Offset = "0x1468630", VA = "0x181469830")]
|
|
public bool GenerateTreeCluster()
|
|
{
|
|
ClusterNode clusterNode = this.unProcessedClusters.Pop();
|
|
bool flag = this.SplitCluster(clusterNode);
|
|
Stack<ClusterNode> stack = this.unProcessedClusters;
|
|
bool flag2;
|
|
return flag2;
|
|
}
|
|
|
|
// Token: 0x06006BBF RID: 27583 RVA: 0x0017E650 File Offset: 0x0017C850
|
|
[Token(Token = "0x6006BBF")]
|
|
[Address(RVA = "0x146A470", Offset = "0x1469270", VA = "0x18146A470")]
|
|
private float GetVolume(Vector3 min, Vector3 max)
|
|
{
|
|
float z = min.z;
|
|
float z2 = max.z;
|
|
Vector3 vector;
|
|
float num = vector.z;
|
|
float num2;
|
|
num = num2;
|
|
num2 = num;
|
|
return num2;
|
|
}
|
|
|
|
// Token: 0x06006BC0 RID: 27584 RVA: 0x0017E680 File Offset: 0x0017C880
|
|
[Token(Token = "0x6006BC0")]
|
|
[Address(RVA = "0x146A3D0", Offset = "0x14691D0", VA = "0x18146A3D0")]
|
|
private float GetVolume(Vector3 size)
|
|
{
|
|
float num = size.z;
|
|
float num2;
|
|
num = num2;
|
|
num2 = num;
|
|
return num2;
|
|
}
|
|
|
|
// Token: 0x06006BC1 RID: 27585 RVA: 0x0017E69C File Offset: 0x0017C89C
|
|
[Token(Token = "0x6006BC1")]
|
|
[Address(RVA = "0x146AA70", Offset = "0x1469870", VA = "0x18146AA70")]
|
|
private bool SplitCluster(ClusterNode cluster)
|
|
{
|
|
int num;
|
|
List<IClusterLODComponent> list;
|
|
int num8;
|
|
do
|
|
{
|
|
num = 0;
|
|
List<IClusterLODComponent> components = cluster.components;
|
|
int num2 = this.minNumObjectPerCluster;
|
|
num2 += num2;
|
|
float num3;
|
|
if (cluster.vertexCount < this.maxNumVerts && this.maxRadius > num3)
|
|
{
|
|
goto IL_20D;
|
|
}
|
|
list = new List();
|
|
float num5;
|
|
float num4 = Mathf.Max(num5, num5) * 0.3f;
|
|
List<IClusterLODComponent> components2 = cluster.components;
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
num += num;
|
|
num++;
|
|
Vector3 vector;
|
|
float num6 = vector.z;
|
|
float num7;
|
|
num5 = num7;
|
|
num5 = Mathf.Max(num7, num5);
|
|
while (num5 <= num4)
|
|
{
|
|
}
|
|
num6 += 2.7E-44f;
|
|
}
|
|
if (num != 0)
|
|
{
|
|
goto IL_21F;
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
if (list._size <= 0)
|
|
{
|
|
goto IL_EA;
|
|
}
|
|
bool flag2;
|
|
if (flag2)
|
|
{
|
|
}
|
|
num8 = 0;
|
|
}
|
|
while (num != 0);
|
|
ClusterNode clusterNode = new ClusterNode(num, cluster);
|
|
cluster.child1 = clusterNode;
|
|
this.<Tree>k__BackingField.Nodes.Add(clusterNode);
|
|
ClusterNode clusterNode2 = new ClusterNode(list, cluster);
|
|
cluster.child2 = clusterNode2;
|
|
List<ClusterNode> nodes = this.<Tree>k__BackingField.Nodes;
|
|
IL_EA:
|
|
ClusterTreeGenerator.SplitResult splitResult;
|
|
int bestIndex = splitResult.bestIndex;
|
|
int num9 = 0;
|
|
List<IClusterLODComponent> range = list.GetRange(num9, bestIndex);
|
|
ClusterNode clusterNode3;
|
|
clusterNode3.parent = cluster;
|
|
clusterNode3.components = range;
|
|
int num10 = 0;
|
|
int vertexCount = ClusterUtil.GetVertexCount(range, (NPBPPKDLKDN)num10);
|
|
clusterNode3.vertexCount = vertexCount;
|
|
cluster.child1 = clusterNode3;
|
|
this.<Tree>k__BackingField.Nodes.Add(clusterNode3);
|
|
int num11 = list._size;
|
|
num11 -= clusterNode3;
|
|
ClusterNode clusterNode4;
|
|
clusterNode4.parent = cluster;
|
|
List<IClusterLODComponent> list2;
|
|
clusterNode4.components = list2;
|
|
int num12 = 0;
|
|
int vertexCount2 = ClusterUtil.GetVertexCount(list2, (NPBPPKDLKDN)num12);
|
|
clusterNode4.vertexCount = vertexCount2;
|
|
cluster.child2 = clusterNode4;
|
|
this.<Tree>k__BackingField.Nodes.Add(clusterNode4);
|
|
Stack<ClusterNode> stack = this.unProcessedClusters;
|
|
ClusterNode child = cluster.child1;
|
|
stack.Push(child);
|
|
Stack<ClusterNode> stack2 = this.unProcessedClusters;
|
|
ClusterNode child2 = cluster.child2;
|
|
stack2.Push(child2);
|
|
List<ClusterNode> nodes2 = this.<Tree>k__BackingField.Nodes;
|
|
ClusterNode child3 = cluster.child1;
|
|
nodes2.Add(child3);
|
|
List<ClusterNode> nodes3 = this.<Tree>k__BackingField.Nodes;
|
|
ClusterNode child4 = cluster.child2;
|
|
nodes3.Add(child4);
|
|
cluster.components = num8;
|
|
IL_20D:
|
|
throw new NullReferenceException();
|
|
IL_21F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06006BC2 RID: 27586 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6006BC2")]
|
|
[Address(RVA = "0x14698A0", Offset = "0x14686A0", VA = "0x1814698A0")]
|
|
private ClusterTreeGenerator.SplitResult GetSplitResult(List<IClusterLODComponent> rawComponents, ClusterTreeGenerator.Axis axis)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06006BC3 RID: 27587 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6006BC3")]
|
|
[Address(RVA = "0x146A6E0", Offset = "0x14694E0", VA = "0x18146A6E0")]
|
|
private void SetupMinMaxBuffers(List<IClusterLODComponent> components, Vector3[] minValues, Vector3[] maxValues)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0400481B RID: 18459
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400481B")]
|
|
private ClusterTreeGenerator.Stats stats;
|
|
|
|
// Token: 0x0400481D RID: 18461
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400481D")]
|
|
private int minNumObjectPerCluster;
|
|
|
|
// Token: 0x0400481E RID: 18462
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x400481E")]
|
|
private int minNumVerts;
|
|
|
|
// Token: 0x0400481F RID: 18463
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400481F")]
|
|
private int maxNumVerts;
|
|
|
|
// Token: 0x04004820 RID: 18464
|
|
[FieldOffset(Offset = "0x34")]
|
|
[Token(Token = "0x4004820")]
|
|
private float maxRadius;
|
|
|
|
// Token: 0x04004821 RID: 18465
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4004821")]
|
|
private float distributeVSminimize;
|
|
|
|
// Token: 0x04004822 RID: 18466
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4004822")]
|
|
private Stack<ClusterNode> unProcessedClusters;
|
|
|
|
// Token: 0x0200128A RID: 4746
|
|
[Token(Token = "0x200128A")]
|
|
private struct Stats
|
|
{
|
|
// Token: 0x04004823 RID: 18467
|
|
[FieldOffset(Offset = "0x0")]
|
|
[Token(Token = "0x4004823")]
|
|
public int numOverSized;
|
|
|
|
// Token: 0x04004824 RID: 18468
|
|
[FieldOffset(Offset = "0x4")]
|
|
[Token(Token = "0x4004824")]
|
|
public int xSplits;
|
|
|
|
// Token: 0x04004825 RID: 18469
|
|
[FieldOffset(Offset = "0x8")]
|
|
[Token(Token = "0x4004825")]
|
|
public int ySplits;
|
|
|
|
// Token: 0x04004826 RID: 18470
|
|
[FieldOffset(Offset = "0xC")]
|
|
[Token(Token = "0x4004826")]
|
|
public int zSplits;
|
|
}
|
|
|
|
// Token: 0x0200128B RID: 4747
|
|
[Token(Token = "0x200128B")]
|
|
private struct SplitResult
|
|
{
|
|
// Token: 0x04004827 RID: 18471
|
|
[FieldOffset(Offset = "0x0")]
|
|
[Token(Token = "0x4004827")]
|
|
public int bestIndex;
|
|
|
|
// Token: 0x04004828 RID: 18472
|
|
[FieldOffset(Offset = "0x4")]
|
|
[Token(Token = "0x4004828")]
|
|
public float bestVolume;
|
|
|
|
// Token: 0x04004829 RID: 18473
|
|
[FieldOffset(Offset = "0x8")]
|
|
[Token(Token = "0x4004829")]
|
|
public List<IClusterLODComponent> components;
|
|
}
|
|
|
|
// Token: 0x0200128C RID: 4748
|
|
[Token(Token = "0x200128C")]
|
|
private enum Axis
|
|
{
|
|
// Token: 0x0400482B RID: 18475
|
|
[Token(Token = "0x400482B")]
|
|
X_AXIS,
|
|
// Token: 0x0400482C RID: 18476
|
|
[Token(Token = "0x400482C")]
|
|
Y_AXIS,
|
|
// Token: 0x0400482D RID: 18477
|
|
[Token(Token = "0x400482D")]
|
|
Z_AXIS
|
|
}
|
|
}
|
|
}
|