Local project added

This commit is contained in:
2025-10-19 22:56:25 +02:00
parent 7c15a8b78d
commit 8124165e9b
96 changed files with 17552 additions and 0 deletions

View File

@ -0,0 +1,52 @@
using UnityEngine;
[ExecuteAlways]
public class VoxelTreeDebugger : MonoBehaviour
{
public bool enableDraw = false;
[Header("Tree reference")]
public OctreeNode root; // Reference to your voxel tree root
[Header("Debug settings")]
public bool drawLeavesOnly = true; // Draw only leaf nodes
public int maxDepthToDraw = 6; // Limit drawing depth
public Color emptyColor = new Color(0f, 0.5f, 1f, 0.2f);
public Color solidColor = new Color(1f, 0f, 0f, 0.5f);
public Color mixedColor = new Color(1f, 1f, 0f, 0.4f);
void OnDrawGizmos()
{
if (root != null && enableDraw)
{
DrawNode(root, 0);
}
}
private void DrawNode(OctreeNode node, int depth)
{
if (node == null || depth > maxDepthToDraw)
return;
// Set color based on node type
if (node.isLeaf)
{
Gizmos.color = node.isOccupied ? solidColor : emptyColor;
Gizmos.DrawWireCube(node.bounds.center, node.bounds.size);
if (node.isOccupied)
Gizmos.DrawCube(node.bounds.center, node.bounds.size * 0.95f);
}
else
{
Gizmos.color = mixedColor;
if (!drawLeavesOnly)
Gizmos.DrawWireCube(node.bounds.center, node.bounds.size);
// Recursively draw children
foreach (var child in node.children)
{
DrawNode(child, depth + 1);
}
}
}
}