public override void SetFilledSides(VoxelOrientationPlane filledPlanes)
        {
            if ((filledPlanes & VoxelOrientationPlane.X_UP) == VoxelOrientationPlane.X_UP)
            {
                xPlane |= UP_MASK;
            }

            if ((filledPlanes & VoxelOrientationPlane.X_DOWN) == VoxelOrientationPlane.X_DOWN)
            {
                xPlane |= DOWN_MASK;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_UP) == VoxelOrientationPlane.Y_UP)
            {
                yPlane |= UP_MASK;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_DOWN) == VoxelOrientationPlane.Y_DOWN)
            {
                yPlane |= DOWN_MASK;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_UP) == VoxelOrientationPlane.Z_UP)
            {
                zPlane |= UP_MASK;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_DOWN) == VoxelOrientationPlane.Z_DOWN)
            {
                zPlane |= DOWN_MASK;
            }
        }
        public override void SetFilledSides(VoxelOrientationPlane filledPlanes)
        {
            if ((filledPlanes & VoxelOrientationPlane.X_UP) == VoxelOrientationPlane.X_UP)
            {
                xPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.X_DOWN) == VoxelOrientationPlane.X_DOWN)
            {
                xPlaneDown = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_UP) == VoxelOrientationPlane.Y_UP)
            {
                yPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_DOWN) == VoxelOrientationPlane.Y_DOWN)
            {
                yPlaneDown = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_UP) == VoxelOrientationPlane.Z_UP)
            {
                zPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_DOWN) == VoxelOrientationPlane.Z_DOWN)
            {
                zPlaneDown = LENGTH_OF_VOXEL;
            }
        }
        public override void SetFilledSides(VoxelOrientationPlane filledPlanes)
        {
            // ReSharper disable BitwiseOperatorOnEnumWithoutFlags
            if ((filledPlanes & VoxelOrientationPlane.X_UP) == VoxelOrientationPlane.X_UP)
            {
                xPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.X_DOWN) == VoxelOrientationPlane.X_DOWN)
            {
                xPlaneDown = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_UP) == VoxelOrientationPlane.Y_UP)
            {
                yPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Y_DOWN) == VoxelOrientationPlane.Y_DOWN)
            {
                yPlaneDown = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_UP) == VoxelOrientationPlane.Z_UP)
            {
                zPlaneUp = LENGTH_OF_VOXEL;
            }

            if ((filledPlanes & VoxelOrientationPlane.Z_DOWN) == VoxelOrientationPlane.Z_DOWN)
            {
                zPlaneDown = LENGTH_OF_VOXEL;
            }
            // ReSharper restore BitwiseOperatorOnEnumWithoutFlags
        }
Exemple #4
0
 public unsafe void SetVoxelPointGlobalIndex(int i, int j, int k, Part p, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 15)
 {
     lock (voxelPoints)
     {
         int index = i + 8 * j + 64 * k - offset;
         SetPart(p, index, plane, location);
     }
 }
Exemple #5
0
 //Sets point and ensures that includedParts includes p
 public unsafe void SetVoxelPointGlobalIndex(int zeroBaseIndex, Part p, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 15)
 {
     lock (voxelPoints)
     {
         zeroBaseIndex -= offset;
         SetPart(p, zeroBaseIndex, plane, location);
     }
 }
 //Use when locking is unnecessary and only to change size, not part
 public void SetVoxelPointGlobalIndexNoLock(
     int zeroBaseIndex,
     byte location,
     VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL
     )
 {
     zeroBaseIndex -= offset;
     voxelPoints[zeroBaseIndex].SetPlaneLocation(plane, location);
 }
 //Use when certain that locking is unnecessary and need to fill the location
 public void SetVoxelPointGlobalIndexNoLock(
     int zeroBaseIndex,
     Part p,
     byte location,
     VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL
     )
 {
     zeroBaseIndex -= offset;
     SetPart(p, zeroBaseIndex, plane, location);
 }
        unsafe void SetPart(Part p, int index, VoxelOrientationPlane plane, byte location)
        {
            Part currentPart = voxelPoints[index].part;
            //if we update the plane location with this, then we can consider replacing the part here.  Otherwise, we don't
            bool largerThanLast = voxelPoints[index].SetPlaneLocation(plane, location);

            if ((object)currentPart == null || overridingParts.Contains(p) || (largerThanLast && !overridingParts.Contains(currentPart)))
            {
                voxelPoints[index].part = p;
            }
        }
        // ReSharper disable once UnusedMember.Global
        public void SetVoxelPointGlobalIndexNoLock(
            int i,
            int j,
            int k,
            Part p,
            byte location,
            VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL
            )
        {
            int index = i + 8 * j + 64 * k - offset;

            SetPart(p, index, plane, location);
        }
        private void SetPart(Part p, int index, VoxelOrientationPlane plane, byte location)
        {
            PartSizePair pair = voxelPoints[index];

            Part currentPart = pair.part;
            //if we update the plane location with this, then we can consider replacing the part here.  Otherwise, we don't
            bool largerThanLast = pair.SetPlaneLocation(plane, location);

            if (currentPart is null ||
                overridingParts.Contains(p) ||
                largerThanLast && !overridingParts.Contains(currentPart))
            {
                pair.part = p;
            }
        }
        private void SetPart(Part p, int index, VoxelOrientationPlane plane, byte location)
        {
            PartSizePair pair = voxelPoints[index];

            Part currentPart = pair.part;
            //if we update the plane location with this, then we can consider replacing the part here.  Otherwise, we don't
            bool largerThanLast  = pair.SetPlaneLocation(plane, location);
            int  currentPriority = PartPriority(currentPart);
            int  newPriority     = PartPriority(p);

            if (newPriority > currentPriority ||
                largerThanLast && currentPriority <= 0)
            {
                pair.part = p;
            }
        }
Exemple #12
0
            //Will return true if the location is updated
            public bool SetPlaneLocation(VoxelOrientationPlane plane, byte location)
            {
                bool returnVal = false;

                switch (plane)
                {
                case VoxelOrientationPlane.X_UP:
                    if (location >= xPlaneUp)
                    {
                        xPlaneUp  = location;
                        returnVal = true;
                    }
                    break;

                case VoxelOrientationPlane.X_DOWN:
                    if (location >= xPlaneDown)
                    {
                        xPlaneDown = location;
                        returnVal  = true;
                    }
                    break;

                case VoxelOrientationPlane.Y_UP:
                    if (location >= yPlaneUp)
                    {
                        yPlaneUp  = location;
                        returnVal = true;
                    }
                    break;

                case VoxelOrientationPlane.Y_DOWN:
                    if (location >= yPlaneDown)
                    {
                        yPlaneDown = location;
                        returnVal  = true;
                    }
                    break;

                case VoxelOrientationPlane.Z_UP:
                    if (location >= zPlaneUp)
                    {
                        zPlaneUp  = location;
                        returnVal = true;
                    }
                    break;

                case VoxelOrientationPlane.Z_DOWN:
                    if (location >= zPlaneDown)
                    {
                        zPlaneDown = location;
                        returnVal  = true;
                    }
                    break;

                case VoxelOrientationPlane.FILL_VOXEL:
                    xPlaneUp = location;
                    yPlaneUp = location;
                    zPlaneUp = location;

                    xPlaneDown = location;
                    yPlaneDown = location;
                    zPlaneDown = location;
                    break;
                }

                return(returnVal);
            }
            public void SetFilledSides(VoxelOrientationPlane filledPlanes)
            {
                if ((filledPlanes & VoxelOrientationPlane.X_UP) == VoxelOrientationPlane.X_UP)
                    xPlane |= UP_MASK;

                if ((filledPlanes & VoxelOrientationPlane.X_DOWN) == VoxelOrientationPlane.X_DOWN)
                    xPlane |= DOWN_MASK;

                if ((filledPlanes & VoxelOrientationPlane.Y_UP) == VoxelOrientationPlane.Y_UP)
                    yPlane |= UP_MASK;

                if ((filledPlanes & VoxelOrientationPlane.Y_DOWN) == VoxelOrientationPlane.Y_DOWN)
                    yPlane |= DOWN_MASK;

                if ((filledPlanes & VoxelOrientationPlane.Z_UP) == VoxelOrientationPlane.Z_UP)
                    zPlane |= UP_MASK;

                if ((filledPlanes & VoxelOrientationPlane.Z_DOWN) == VoxelOrientationPlane.Z_DOWN)
                    zPlane |= DOWN_MASK;
            }
        //Will return true if the location is updated
        public override bool SetPlaneLocation(VoxelOrientationPlane plane, byte location)
        {
            bool returnVal = false;

            switch (plane)
            {
                case VoxelOrientationPlane.X_UP:
                    {
                        if (location > xPlaneUp)
                        {
                            xPlaneUp = location;
                            returnVal = true;
                        }
                        break;
                    }

                case VoxelOrientationPlane.X_DOWN:
                    {
                        if (location > xPlaneDown)
                        {
                            xPlaneDown = location;
                            returnVal = true;
                        }
                        break;
                    }

                case VoxelOrientationPlane.Y_UP:
                    {
                        if (location > yPlaneUp)
                        {
                            yPlaneUp = location;
                            returnVal = true;
                        }
                        break;
                    }

                case VoxelOrientationPlane.Y_DOWN:
                    {
                        if (location > yPlaneDown)
                        {
                            yPlaneDown = location;
                            returnVal = true;
                        }
                        break;

                    }

                case VoxelOrientationPlane.Z_UP:
                    {
                        if (location > zPlaneUp)
                        {
                            zPlaneUp = location;
                            returnVal = true;
                        }
                        break;

                    }

                case VoxelOrientationPlane.Z_DOWN:
                    {
                        if (location > zPlaneDown)
                        {
                            zPlaneDown = location;
                            returnVal = true;
                        }
                        break;

                    }

                case VoxelOrientationPlane.FILL_VOXEL:
                    {
                        if (location > xPlaneUp)
                            xPlaneUp = location;
                        if (location > xPlaneDown)
                            xPlaneDown = location;

                        if (location > yPlaneUp)
                            yPlaneUp = location;
                        if (location > yPlaneDown)
                            yPlaneDown = location;

                        if (location > zPlaneUp)
                            zPlaneUp = location;
                        if (location > zPlaneDown)
                            zPlaneDown = location;

                        break;
                    }
            }

            return returnVal;
        }
            //Will return true if the location is updated
            public bool SetPlaneLocation(VoxelOrientationPlane plane, byte location)
            {
                bool returnVal = false;

                switch (plane)
                {
                    case VoxelOrientationPlane.X_UP:
                        {
                            location = (byte)(location << 4);   //shift the byte as necessary
                            if (location > (xPlane & UP_MASK))     //only compare upper bits
                            {
                                xPlane &= DOWN_MASK;     //clear out all 4 upper bits but keep lower bits
                                xPlane |= location; //then overwrite them from location
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.X_DOWN:
                        {
                            if (location > (xPlane & DOWN_MASK))
                            {
                                xPlane &= UP_MASK;     //clear out all 4 lower bits
                                xPlane |= location;
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.Y_UP:
                        {
                            location = (byte)(location << 4);   //shift the byte as necessary
                            if (location > (yPlane & UP_MASK))
                            {
                                yPlane &= DOWN_MASK;     //clear out all 4 upper bits
                                yPlane |= location; //then overwrite them from location
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.Y_DOWN:
                        {
                            if (location > (yPlane & DOWN_MASK))
                            {
                                yPlane &= UP_MASK;     //clear out all 4 lower bits
                                yPlane |= location;
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.Z_UP:
                        {
                            location = (byte)(location << 4);   //shift the byte as necessary
                            if (location > (zPlane & UP_MASK))
                            {
                                zPlane &= DOWN_MASK;     //clear out all 4 upper bits
                                zPlane |= location; //then overwrite them from location
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.Z_DOWN:
                        {
                            if (location > (zPlane & DOWN_MASK))
                            {
                                zPlane &= UP_MASK;     //clear out all 4 lower bits
                                zPlane |= location;
                                returnVal = true;
                            }
                            break;
                        }

                    case VoxelOrientationPlane.FILL_VOXEL:
                        {
                            if (location > (xPlane & DOWN_MASK))
                            {
                                xPlane &= UP_MASK;     //clear out all 4 lower bits
                                xPlane |= location;
                            }
                            if (location > (yPlane & DOWN_MASK))
                            {
                                yPlane &= UP_MASK;     //clear out all 4 lower bits
                                yPlane |= location;
                            }
                            if (location > (zPlane & DOWN_MASK))
                            {
                                zPlane &= UP_MASK;     //clear out all 4 lower bits
                                zPlane |= location;
                            }
                            location = (byte)(location << 4);   //shift the byte as necessary

                            if (location > (xPlane & UP_MASK))
                            {
                                xPlane &= DOWN_MASK;     //clear out all 4 upper bits
                                xPlane |= location; //then overwrite them from location
                            }
                            if (location > (yPlane & UP_MASK))
                            {
                                yPlane &= DOWN_MASK;     //clear out all 4 upper bits
                                yPlane |= location; //then overwrite them from location
                            }
                            if (location > (zPlane & UP_MASK))
                            {
                                zPlane &= DOWN_MASK;     //clear out all 4 upper bits
                                zPlane |= location; //then overwrite them from location
                            }
                            break;
                        }
                }

                return returnVal;
            }
            public void SetFilledSides(VoxelOrientationPlane filledPlanes)
            {
                if ((filledPlanes & VoxelOrientationPlane.X_UP) == VoxelOrientationPlane.X_UP)
                    xPlaneUp = LENGTH_OF_VOXEL;

                if ((filledPlanes & VoxelOrientationPlane.X_DOWN) == VoxelOrientationPlane.X_DOWN)
                    xPlaneDown = LENGTH_OF_VOXEL;

                if ((filledPlanes & VoxelOrientationPlane.Y_UP) == VoxelOrientationPlane.Y_UP)
                    yPlaneUp = LENGTH_OF_VOXEL;

                if ((filledPlanes & VoxelOrientationPlane.Y_DOWN) == VoxelOrientationPlane.Y_DOWN)
                    yPlaneDown = LENGTH_OF_VOXEL;

                if ((filledPlanes & VoxelOrientationPlane.Z_UP) == VoxelOrientationPlane.Z_UP)
                    zPlaneUp = LENGTH_OF_VOXEL;

                if ((filledPlanes & VoxelOrientationPlane.Z_DOWN) == VoxelOrientationPlane.Z_DOWN)
                    zPlaneDown = LENGTH_OF_VOXEL;
            }
            //Will return true if the location is updated
            public bool SetPlaneLocation(VoxelOrientationPlane plane, byte location)
            {
                bool returnVal = false;
                switch (plane)
                {
                    case VoxelOrientationPlane.X_UP:
                        if (location >= xPlaneUp)
                        {
                            xPlaneUp = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.X_DOWN:
                        if (location >= xPlaneDown)
                        {
                            xPlaneDown = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.Y_UP:
                        if (location >= yPlaneUp)
                        {
                            yPlaneUp = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.Y_DOWN:
                        if (location >= yPlaneDown)
                        {
                            yPlaneDown = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.Z_UP:
                        if (location >= zPlaneUp)
                        {
                            zPlaneUp = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.Z_DOWN:
                        if (location >= zPlaneDown)
                        {
                            zPlaneDown = location;
                            returnVal = true;
                        }
                        break;

                    case VoxelOrientationPlane.FILL_VOXEL:
                        xPlaneUp = location;
                        yPlaneUp = location;
                        zPlaneUp = location;

                        xPlaneDown = location;
                        yPlaneDown = location;
                        zPlaneDown = location;
                        break;
                }

                return returnVal;
            }
 public unsafe void SetVoxelPointGlobalIndexNoLock(int i, int j, int k, Part p, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 255)
 {
     int index = i + 8 * j + 64 * k - offset;
     SetPart(p, index, plane, location);
 }
 unsafe void SetPart(Part p, int index, VoxelOrientationPlane plane, byte location)
 {
     Part currentPart = voxelPoints[index].part;
     //if we update the plane location with this, then we can consider replacing the part here.  Otherwise, we don't
     bool largerThanLast = voxelPoints[index].SetPlaneLocation(plane, location);
     if ((object)currentPart == null || overridingParts.Contains(p) || (largerThanLast && !overridingParts.Contains(currentPart)))
         voxelPoints[index].part = p;
 }
 //Use when locking is unnecessary and only to change size, not part
 public unsafe void SetVoxelPointGlobalIndexNoLock(int zeroBaseIndex, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 255)
 {
     zeroBaseIndex -= offset;
     //voxelPoints[zeroBaseIndex].part = p;
     voxelPoints[zeroBaseIndex].SetPlaneLocation(plane, location);
 }
 //Use when certian that locking is unnecessary
 public unsafe void SetVoxelPointGlobalIndexNoLock(int zeroBaseIndex, Part p, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 255)
 {
     zeroBaseIndex -= offset;
     SetPart(p, zeroBaseIndex, plane, location);
 }
        private void SetVoxelPoint(int i, int j, int k, Part part, VoxelOrientationPlane plane, byte location)
        {
            int iSec, jSec, kSec;
            //Find the voxel section that this point points to

            iSec = i >> 3;
            jSec = j >> 3;
            kSec = k >> 3;

            VoxelChunk section;

            lock (voxelChunks)
            {
                section = voxelChunks[iSec, jSec, kSec];
                if (section == null)
                {
                    lock(clearedChunks)
                    {
                        if(clearedChunks.Count > 0)
                        {
                            section = clearedChunks.Pop();
                        }
                    }
                    if (section == null)
                        section = new VoxelChunk(elementSize, lowerRightCorner + new Vector3d(iSec, jSec, kSec) * elementSize * 8, iSec * 8, jSec * 8, kSec * 8, overridingParts);
                    else
                        section.SetChunk(elementSize, lowerRightCorner + new Vector3d(iSec, jSec, kSec) * elementSize * 8, iSec * 8, jSec * 8, kSec * 8, overridingParts);

                    voxelChunks[iSec, jSec, kSec] = section;
                }
            }

            //Debug.Log(i.ToString() + ", " + j.ToString() + ", " + k.ToString() + ", " + part.partInfo.title);

            section.SetVoxelPointGlobalIndex(i + j * 8 + k * 64, part, plane, location);
        }
Exemple #23
0
 //Use when locking is unnecessary and only to change size, not part
 public unsafe void SetVoxelPointGlobalIndexNoLock(int zeroBaseIndex, VoxelOrientationPlane plane = VoxelOrientationPlane.FILL_VOXEL, byte location = 15)
 {
     zeroBaseIndex -= offset;
     //voxelPoints[zeroBaseIndex].part = p;
     voxelPoints[zeroBaseIndex].SetPlaneLocation(plane, location);
 }
Exemple #24
0
 //Will return true if the location is updated
 public abstract bool SetPlaneLocation(VoxelOrientationPlane plane, byte location);
Exemple #25
0
 public abstract void SetFilledSides(VoxelOrientationPlane filledPlanes);
        //Will return true if the location is updated
        public override bool SetPlaneLocation(VoxelOrientationPlane plane, byte location)
        {
            bool returnVal = false;

            switch (plane)
            {
            case VoxelOrientationPlane.X_UP:
            {
                location = (byte)(location << 4);  //shift the byte as necessary
                if (location > (xPlane & UP_MASK)) //only compare upper bits
                {
                    xPlane   &= DOWN_MASK;         //clear out all 4 upper bits but keep lower bits
                    xPlane   |= location;          //then overwrite them from location
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.X_DOWN:
            {
                if (location > (xPlane & DOWN_MASK))
                {
                    xPlane   &= UP_MASK;           //clear out all 4 lower bits
                    xPlane   |= location;
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.Y_UP:
            {
                location = (byte)(location << 4);           //shift the byte as necessary
                if (location > (yPlane & UP_MASK))
                {
                    yPlane   &= DOWN_MASK;      //clear out all 4 upper bits
                    yPlane   |= location;       //then overwrite them from location
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.Y_DOWN:
            {
                if (location > (yPlane & DOWN_MASK))
                {
                    yPlane   &= UP_MASK;           //clear out all 4 lower bits
                    yPlane   |= location;
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.Z_UP:
            {
                location = (byte)(location << 4);           //shift the byte as necessary
                if (location > (zPlane & UP_MASK))
                {
                    zPlane   &= DOWN_MASK;      //clear out all 4 upper bits
                    zPlane   |= location;       //then overwrite them from location
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.Z_DOWN:
            {
                if (location > (zPlane & DOWN_MASK))
                {
                    zPlane   &= UP_MASK;           //clear out all 4 lower bits
                    zPlane   |= location;
                    returnVal = true;
                }
                break;
            }

            case VoxelOrientationPlane.FILL_VOXEL:
            {
                if (location > (xPlane & DOWN_MASK))
                {
                    xPlane &= UP_MASK;             //clear out all 4 lower bits
                    xPlane |= location;
                }
                if (location > (yPlane & DOWN_MASK))
                {
                    yPlane &= UP_MASK;             //clear out all 4 lower bits
                    yPlane |= location;
                }
                if (location > (zPlane & DOWN_MASK))
                {
                    zPlane &= UP_MASK;             //clear out all 4 lower bits
                    zPlane |= location;
                }
                location = (byte)(location << 4);           //shift the byte as necessary

                if (location > (xPlane & UP_MASK))
                {
                    xPlane &= DOWN_MASK;        //clear out all 4 upper bits
                    xPlane |= location;         //then overwrite them from location
                }
                if (location > (yPlane & UP_MASK))
                {
                    yPlane &= DOWN_MASK;        //clear out all 4 upper bits
                    yPlane |= location;         //then overwrite them from location
                }
                if (location > (zPlane & UP_MASK))
                {
                    zPlane &= DOWN_MASK;        //clear out all 4 upper bits
                    zPlane |= location;         //then overwrite them from location
                }
                break;
            }
            }

            return(returnVal);
        }