Files
SoundTool/Assets/Scripts/VoxelOctree/CPU/OctreeNode.cs
2025-10-19 22:56:25 +02:00

39 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class OctreeNode
{
public Bounds bounds; // The 3D space covered by this node
public bool isLeaf; // True if this node is not subdivided
public bool isOccupied; // True if this node contains solid voxels
public bool hasChildrenOccupied; // True if this node contains solid voxels
public OctreeNode[] children; // 8 sub-nodes (for each octant)
public float penetrationFactor;
public float reflexionFactor;
public OctreeNode(Bounds bounds)
{
penetrationFactor = 1;
reflexionFactor = 1;
this.bounds = bounds;
isLeaf = true;
isOccupied = false;
hasChildrenOccupied = false;
children = new OctreeNode[8];
children[0] = null;
children[1] = null;
children[2] = null;
children[3] = null;
children[4] = null;
children[5] = null;
children[6] = null;
children[7] = null;
}
}