Beispiel #1
0
 private void BuildVisibilityList(BspTreeLeaf bspTreeLeaf, dleaf_t leaf, int v)
 {
     if (v < 0)
         return;
     // Suppose Leaf is the leaf the player is in.
     for (int L = 1; L < dleaves.Count && v<visilist.Length; v++)
     {
         if (visilist[v] == 0)           // value 0, leaves invisible
         {
             L += 8 * visilist[v + 1];    // skip some leaves
             v++;
         }
         else                          // tag 8 leaves, if needed
         {                           // examine bits right to left
             for (byte bit = 1; bit != 0 && L < dleaves.Count; bit = (byte)(bit << 1), ++L)
             {
                 if (0 != (visilist[v] & bit))
                 {
                     if (L >= leaves.Count)
                         throw new ApplicationException(string.Format("leaf index {0} is out of {1}",L,leaves.Count));
                     bspTreeLeaf.VisibleLeaves.Add(leaves[L]);
                     leaf.VisibleLeaves.Add(L);
                 }
             }
         }
     }
 }
Beispiel #2
0
 private BspTreeLeaf BuildLeaf(dleaf_t dleaf)
 {
     var res = new BspTreeLeaf();
     res.Mins = new Vector3(dleaf.box.mins[0], dleaf.box.mins[1], dleaf.box.mins[2]);
     res.Maxs = new Vector3(dleaf.box.maxs[0], dleaf.box.maxs[1], dleaf.box.maxs[2]);
     if (dleaf.lface_num > 0)
         res.Colliders.Add(BuildFaceSoup(dleaf.lface_id, dleaf.lface_num));
     return res;
 }
Beispiel #3
0
        private BspTreeLeaf BuildLeaf(leaf_t dleaf)
        {
            var res = new BspTreeLeaf();
            res.Mins = new Vector3(dleaf.box.mins[0], dleaf.box.mins[1], dleaf.box.mins[2]);
            res.Maxs = new Vector3(dleaf.box.maxs[0], dleaf.box.maxs[1], dleaf.box.maxs[2]);

            for (int i = dleaf.leafbrush; i < dleaf.leafbrush + dleaf.n_leafbrushes; ++i)
            {
                BspCollisionObject b = BuildLeafBrush((int)listOfBrushes[i]);
                if (b != null)
                    res.Colliders.Add(b);
            }

            //res.Geometries.Add(BuildGeometry((uint)dleaf.leafface, (uint)dleaf.n_leaffaces));
            return res;
        }
Beispiel #4
0
        private BspTreeLeaf BuildLeaf(dleaf_t dleaf)
        {
            var res = new BspTreeLeaf();
            res.Mins = new Vector3(dleaf.box.mins[0], dleaf.box.mins[1], dleaf.box.mins[2]);
            res.Maxs = new Vector3(dleaf.box.maxs[0], dleaf.box.maxs[1], dleaf.box.maxs[2]);

            //if (dleaf.firstleafface != ushort.MaxValue)
            //	res.Geometries.Add(BuildGeometry(dleaf.firstleafface, dleaf.numleaffaces));
            return res;
        }
Beispiel #5
0
 private BspTreeLeaf BuildLeaf(leaf_t dleaf)
 {
     var res = new BspTreeLeaf();
     res.Mins = new Vector3(dleaf.box.mins[0], dleaf.box.mins[1], dleaf.box.mins[2]);
     res.Maxs = new Vector3(dleaf.box.maxs[0], dleaf.box.maxs[1], dleaf.box.maxs[2]);
     //for (int i = dleaf.first_leaf_brush; i < dleaf.first_leaf_brush + dleaf.num_leaf_brushes; ++i)
     //{
     //    BspCollisionObject b = BuildLeafBrush((int)listOfBrushes[i]);
     //    if (b != null)
     //        res.Colliders.Add(b);
     //}
     return res;
 }