Exemple #1
0
 public void alterBox(Vector3i min, Vector3i size, sbyte value)
 {
     for (int x = min.getX(); x < (min + size).getX(); x++)
         for (int y = min.getY(); y <= (min + size).getY(); y++)
             for (int z = min.getZ(); z <= (min + size).getZ(); z++)
             {
                 alterPoint(x, y, z, value);
             }
 }
Exemple #2
0
        public sbyte average(Vector3i min, int size)
        {
            size++;

            int sum = 0;
            int i=0;
            for (int x = 0; x < size; x++)
                for (int y = 0; y < size; y++)
                    for (int z = 0; z < size; z++)
                    {
                        sum += getPoint(x+min.getX(), y+min.getY(), z+min.getZ());
                        i++;
                    }

            //Console.WriteLine("SUM: "+sum+"  AVG: "+(sum/i)+" @"+i);
            return (sbyte)(sum / i);
        }
Exemple #3
0
 public byte getPoint(Vector3i i)
 {
     return getPoint(i.getX(), i.getY(), i.getZ());
 }
Exemple #4
0
 public void setPoint(Vector3i v, byte c)
 {
     setPoint(v.getX(), v.getY(), v.getZ(), c);
 }
Exemple #5
0
 public byte getPoint(Vector3i i)
 {
     return(getPoint(i.getX(), i.getY(), i.getZ()));
 }
Exemple #6
0
 public void setPoint(Vector3i v, byte c)
 {
     setPoint(v.getX(), v.getY(), v.getZ(), c);
 }
Exemple #7
0
 public Cell(VoxelMap data, Vector3i pos)
 {
     this.data = data;
     this.pos = pos;
 }
Exemple #8
0
        private void EliminateLodPositionShift(int lod, ref byte d0, ref byte d1, ref long t, ref Vector3i iP0, ref Vector3f P0, ref Vector3i iP1, ref Vector3f P1)
        {
            for (int k = 0; k < lod - 1; k++)
            {
                Vector3f vm = (P0 + P1) / 2.0f;
                Vector3i pm = (iP0 + iP1) / 2;
                byte sm = data.getPoint(pm);

                if (Math.Sign(d0) != Math.Sign(sm))
                {
                    P1 = vm;
                    iP1 = pm;
                    d1 = sm;
                }
                else
                {
                    P0 = vm;
                    iP0 = pm;
                    d0 = sm;
                }
            }

            t = (d1 << 8) / (d1 - d0); // recalc
        }
Exemple #9
0
        private static Cell getReuseCell(Cell[, ,] cells, int lod, byte rDir,Vector3i pos)
        {
            int rx = rDir & 0x01;
            int rz = (rDir >> 1) & 0x01;
            int ry = (rDir >> 2) & 0x01;

            int dx = pos.getX() / lod - rx;
            int dy = pos.getY() / lod - ry;
            int dz = pos.getZ() / lod - rz;

            Cell ccc = cells[dx, dy, dz];
            return ccc;
        }