Esempio n. 1
0
    private unsafe void DoGetBlockedBoxes(ref List <VoxelBoxInfo> boxList)
    {
        SVONVoxelBox *blockedBoxes = null;
        int           boxCount     = 0;

        using (GenerateGetVolumeVoxelBoxesWrapper(volumeHandle, out blockedBoxes, out boxCount))
        {
            if (boxCount > 0)
            {
                SVONVoxelBox *pBox = blockedBoxes;
                for (int i = 0; i < boxCount; ++i)
                {
                    VoxelBoxInfo box = new VoxelBoxInfo
                    {
                        layer      = pBox->layer,
                        blocked    = pBox->blocked,
                        extent     = pBox->extent,
                        mortonCode = pBox->mortonCode,
                        boxCenter  = pBox->boxCenter.ToVector3()
                    };
                    boxList.Add(box);

                    ++pBox;
                }
            }
        }
    }
Esempio n. 2
0
    private static unsafe BlockedBoxesSafeHandle GenerateGetVolumeVoxelBoxesWrapper(IntPtr volume,
                                                                                    out SVONVoxelBox *oBoxes,
                                                                                    out int count)
    {
        BlockedBoxesSafeHandle itemsSafeHandle;

        if (!SVONGetVolumeVoxelBoxes(volume, out itemsSafeHandle, out oBoxes, out count))
        {
            Debug.Log($"Get Blocked Boxes failed!");
        }
        return(itemsSafeHandle);
    }
Esempio n. 3
0
 private static unsafe extern bool SVONGetVolumeVoxelBoxes(IntPtr volume,
                                                           out BlockedBoxesSafeHandle boxesHandle,
                                                           out SVONVoxelBox *oBoxes,
                                                           out int count);