Got rid of previous material system, now uses enumerators and item ids. Also imported QuadTree.cs so we can have entity collision.
This commit is contained in:
@@ -10,8 +10,8 @@ namespace QuadTree
|
|||||||
|
|
||||||
public class QuadTree<T>
|
public class QuadTree<T>
|
||||||
{
|
{
|
||||||
private static Stack<Branch> branchPool = new Stack<Branch>();
|
private static Stack<Branch> _branchPool = new Stack<Branch>();
|
||||||
private static Stack<Leaf> leafPool = new Stack<Leaf>();
|
private static Stack<Leaf> _leafPool = new Stack<Leaf>();
|
||||||
|
|
||||||
private readonly Branch _root;
|
private readonly Branch _root;
|
||||||
private readonly int _splitCount;
|
private readonly int _splitCount;
|
||||||
@@ -49,8 +49,8 @@ namespace QuadTree
|
|||||||
|
|
||||||
public static void ClearPools()
|
public static void ClearPools()
|
||||||
{
|
{
|
||||||
branchPool = new Stack<Branch>();
|
_branchPool = new Stack<Branch>();
|
||||||
leafPool = new Stack<Leaf>();
|
_leafPool = new Stack<Leaf>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ namespace QuadTree
|
|||||||
|
|
||||||
private static Branch CreateBranch(QuadTree<T> tree, Branch parent, int branchDepth, ref Quad quad)
|
private static Branch CreateBranch(QuadTree<T> tree, Branch parent, int branchDepth, ref Quad quad)
|
||||||
{
|
{
|
||||||
var branch = branchPool.Count > 0 ? branchPool.Pop() : new Branch();
|
var branch = _branchPool.Count > 0 ? _branchPool.Pop() : new Branch();
|
||||||
branch.Tree = tree;
|
branch.Tree = tree;
|
||||||
branch.Parent = parent;
|
branch.Parent = parent;
|
||||||
branch.Split = false;
|
branch.Split = false;
|
||||||
@@ -176,7 +176,7 @@ namespace QuadTree
|
|||||||
|
|
||||||
private static Leaf CreateLeaf(T value, ref Quad quad)
|
private static Leaf CreateLeaf(T value, ref Quad quad)
|
||||||
{
|
{
|
||||||
var leaf = leafPool.Count > 0 ? leafPool.Pop() : new Leaf();
|
var leaf = _leafPool.Count > 0 ? _leafPool.Pop() : new Leaf();
|
||||||
leaf.Value = value;
|
leaf.Value = value;
|
||||||
leaf.Quad = quad;
|
leaf.Quad = quad;
|
||||||
return leaf;
|
return leaf;
|
||||||
@@ -201,14 +201,14 @@ namespace QuadTree
|
|||||||
for (var i = 0; i < 4; ++i)
|
for (var i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
if (Branches[i] == null) continue;
|
if (Branches[i] == null) continue;
|
||||||
branchPool.Push(Branches[i]);
|
_branchPool.Push(Branches[i]);
|
||||||
Branches[i].Clear();
|
Branches[i].Clear();
|
||||||
Branches[i] = null;
|
Branches[i] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var t in Leaves)
|
foreach (var t in Leaves)
|
||||||
{
|
{
|
||||||
leafPool.Push(t);
|
_leafPool.Push(t);
|
||||||
t.Branch = null;
|
t.Branch = null;
|
||||||
t.Value = default;
|
t.Value = default;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user