コード例 #1
0
ファイル: Quake3Reader.cs プロジェクト: marmalade/bsp4Airplay
        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
ファイル: QuakeReader.cs プロジェクト: marmalade/bsp4Airplay
 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
ファイル: HL2Reader.cs プロジェクト: marmalade/bsp4Airplay
 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
ファイル: Quake3Reader.cs プロジェクト: marmalade/bsp4Airplay
 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);
 }