Esempio n. 1
0
 public static BvhILS2 FindContourAndChildHoleBarriersBvh(this PolyNode node)
 {
     if (node.visibilityGraphNodeData.ContourAndChildHoleBarriersBvh != null)
     {
         return(node.visibilityGraphNodeData.ContourAndChildHoleBarriersBvh);
     }
     return(node.visibilityGraphNodeData.ContourAndChildHoleBarriersBvh = BvhILS2.Build(node.FindContourAndChildHoleBarriers()));
 }
Esempio n. 2
0
        private PolyTree PostProcessPunchedLand(PolyTree punchedLand)
        {
            void TagSectorSnapshotAndGeometryContext(PolyNode node)
            {
                node.visibilityGraphNodeData.LocalGeometryView = this;
                node.Childs.ForEach(TagSectorSnapshotAndGeometryContext);
            }

            void TagBoundingVolumeHierarchies(PolyNode node)
            {
                var contourEdges = node.Contour.Zip(node.Contour.RotateLeft(), IntLineSegment2.Create).ToArray();
                var bvh          = BvhILS2.Build(contourEdges);

                node.visibilityGraphNodeData.ContourBvh = bvh;
                node.Childs.ForEach(TagBoundingVolumeHierarchies);
            }

            punchedLand.Prune(HoleDilationRadius);
            TagSectorSnapshotAndGeometryContext(punchedLand);
            TagBoundingVolumeHierarchies(punchedLand);
            return(punchedLand);
        }