예제 #1
0
 public Voxel(Vector3Int index, Grid3d grid)
 {
     _grid    = grid;
     Index    = index;
     Center   = grid.Corner + new Vector3(index.x + 0.5f, index.y + 0.5f, index.z + 0.5f) * grid.VoxelSize;
     IsActive = true;
 }
예제 #2
0
 public Voxel(Voxel voxel)
 {
     _grid    = voxel._grid;
     Index    = voxel.Index;
     Center   = voxel.Center;
     IsActive = voxel.IsActive;
     _grid.Voxels[Index.x, Index.y, Index.z] = this;
 }
예제 #3
0
파일: Edge.cs 프로젝트: ADRC4/Voxel
 public Edge(int x, int y, int z, Axis direction, Grid3d grid)
 {
     _grid     = grid;
     Index     = new Vector3Int(x, y, z);
     Direction = direction;
     Center    = GetCenter();
     Voxels    = GetVoxels();
     Faces     = GetFaces();
 }
예제 #4
0
파일: Face.cs 프로젝트: ADRC4/Voxel
        public Face(int x, int y, int z, Axis direction, Grid3d grid)
        {
            _grid     = grid;
            Index     = new Vector3Int(x, y, z);
            Direction = direction;
            Voxels    = GetVoxels();

            foreach (var v in Voxels.Where(v => v != null))
            {
                v.Faces.Add(this);
            }

            Center = GetCenter();
        }
예제 #5
0
파일: Grid3d.cs 프로젝트: ADRC4/Voxel
        // public Mesh[] Mesh;

        public static Grid3d MakeGridWithVoids(IEnumerable <MeshCollider> voids, float voxelSize, bool invert = false)
        {
            var bbox = new Bounds();

            foreach (var v in voids.Select(v => v.bounds))
            {
                bbox.Encapsulate(v);
            }

            var grid = new Grid3d(bbox, voxelSize);

            grid.AddVoids(voids, invert);

            return(grid);
        }
예제 #6
0
파일: Grid3dPool.cs 프로젝트: ADRC4/Voxel
 public void PutObject(Grid3d item)
 {
     _objects.Add(item);
 }
예제 #7
0
파일: Grid3dPool.cs 프로젝트: ADRC4/Voxel
 public Grid3dPool(Grid3d grid)
 {
     _objects = new ConcurrentBag <Grid3d>();
     _grid    = grid;
 }
예제 #8
0
파일: Corner.cs 프로젝트: ADRC4/Voxel
 public Corner(Vector3Int index, Grid3d grid)
 {
     _grid    = grid;
     Index    = index;
     Position = grid.Corner + new Vector3(index.x, index.y, index.z) * grid.VoxelSize;
 }