Example #1
0
            public void Execute()
            {
                // Translate the World space AABB into grid coordinates.
                var gridLocalMin = math.transform(ToGridLocalMatrix, Box.Bounds.min);
                var gridLocalMax = math.transform(ToGridLocalMatrix, Box.Bounds.max);
                var gridPointMin = GetNearestNodeIndices(Array, gridLocalMin, ViewData);
                var gridPointMax = GetNearestNodeIndices(Array, gridLocalMax, ViewData);

                for (var x = gridPointMin.x; x <= gridPointMax.x; x++)
                {
                    for (var y = gridPointMin.y; y <= gridPointMax.y; y++)
                    {
                        for (var z = gridPointMin.z; z <= gridPointMax.z; z++)
                        {
                            ref var node = ref Array.AsRef(x, y, z);

                            // Move GridLocal point into world space for comparison
                            var worldNavigableCenter = math.transform(ToGridWorldMatrix, node.NavigableCenter);
                            if (Box.Contains(worldNavigableCenter))
                            {
                                node.Flags |= Flags;
                            }
                        }
                    }
                }
Example #2
0
 public void Execute()
 {
     for (var x = LocalGridMin.x; x <= LocalGridMax.x; x++)
     {
         for (var y = LocalGridMin.y; y <= LocalGridMax.y; y++)
         {
             for (var z = LocalGridMin.z; z <= LocalGridMax.z; z++)
             {
                 Grid.AsRef(x, y, z).Flags |= Flags;
             }
         }
     }
 }