예제 #1
0
        private void BuildClusters()
        {
            FaceToLeafMap faceMap = new FaceToLeafMap(faces.Count);
            for (int i = 0; i < dleaves.Count; ++i)
            {
                var dleaf = dleaves[i];
                BuilFaceToLeafMap(faceMap, i, dleaf);
                if (dleaf.cluster >= 0)
                {
                    foreach (var vis in clusters[dleaf.cluster].lists)
                    {
                        dleaf = dleaves[vis];
                        BuilFaceToLeafMap(faceMap, i, dleaf);
                    }
                    foreach (var visC in clusters[dleaf.cluster].visiblity)
                        foreach (var vis in clusters[visC].lists)
                        {
                            dleaf = dleaves[vis];
                            BuilFaceToLeafMap(faceMap, i, dleaf);
                        }
                }
            }
            var keys = faceMap.FindUniqueKeys();

            foreach (var k in keys)
            {
                if (k.Faces.Count > 0)
                {
                    var geo = BuildGeometry(k.Faces);
                    if (geo != null)
                    {
                        foreach (var l in k.Key.Leaves)
                            leaves[l.Key].Geometries.Add(geo);
                    }
                }
            }
        }
예제 #2
0
 private void BuilFaceToLeafMap(FaceToLeafMap faceMap, int i, dleaf_t dleaf)
 {
     if (dleaf.lface_num >= 0)
         for (int j = dleaf.lface_id; j < dleaf.lface_id + dleaf.lface_num; ++j)
             faceMap.Faces[listOfFaces[j]].AddLeaf(i);
 }
예제 #3
0
 private void BuilFaceToLeafMap(FaceToLeafMap faceMap, int i, dleaf_t dleaf)
 {
     if (dleaf.numleaffaces >= 0 && dleaf.firstleafface >= 0 && dleaf.firstleafface != ushort.MaxValue)
         for (int j = dleaf.firstleafface; j < dleaf.firstleafface + dleaf.numleaffaces; ++j)
             faceMap.Faces[(int)listOfFaces[j]].AddLeaf(i);
 }
예제 #4
0
 private void BuilFaceToLeafMap(FaceToLeafMap faceMap, int i, leaf_t dleaf)
 {
     if (dleaf.leafface >= 0 && dleaf.n_leaffaces >= 0)
         for (int j = dleaf.leafface; j < dleaf.leafface + dleaf.n_leaffaces; ++j)
             faceMap.Faces[(int)listOfFaces[j]].AddLeaf(i);
 }