/// <summary>
        /// Calculates a three dimensional boundingbox for this room
        /// on the fly - either based on walls or editor walls and on sectors.
        /// Note: Z is the height.
        /// </summary>
        /// <returns>
        /// If UseClientWalls=true, BoundingBox in 1:1024 scale based on RooWalls,
        /// else BoundingBox in 1:64 based on RooEditorWalls
        /// </returns>
        public BoundingBox3D GetBoundingBox3D(bool UseClientWalls = true)
        {
            // must have at least a sector
            if (Sectors.Count == 0)
                return BoundingBox3D.NULL;

            // get 2D boundingbox
            BoundingBox2D box2D = GetBoundingBox2D(UseClientWalls);

            // zero 2d box -> zero 3d box
            if (box2D == BoundingBox2D.NULL)
                return BoundingBox3D.NULL;

            // initial 3d box based on 2d box and first sector
            BoundingBox3D box3D = new BoundingBox3D(
                new V3(box2D.Min.X, box2D.Min.Y, Sectors[0].FloorHeight),
                new V3(box2D.Max.X, box2D.Max.Y, Sectors[0].CeilingHeight));

            // extend by sector heights
            for(int i = 1; i < Sectors.Count; i++)
            {
                box3D.ExtendByPoint(new V3(box3D.Min.X, box3D.Min.Y, Sectors[i].FloorHeight));
                box3D.ExtendByPoint(new V3(box3D.Max.X, box3D.Max.Y, Sectors[i].CeilingHeight));
            }

            // scale height from kod/editor fineness (1:64) to oldclient fineness (1:1024)
            if (UseClientWalls)
            {
                box3D.Min.Z *= 16f;
                box3D.Max.Z *= 16f;
            }

            return box3D;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Typed equals
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool Equals(BoundingBox3D obj)
 {
     return(obj.Min == Min && obj.Max == Max);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Possibly extends the Min and Max by the
 /// Min and Max of parameter.
 /// </summary>
 /// <param name="Box"></param>
 public void ExtendByBoundingBox(BoundingBox3D Box)
 {
     ExtendByPoint(Box.Min);
     ExtendByPoint(Box.Max);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Possibly extends the Min and Max by the
 /// Min and Max of parameter.
 /// </summary>
 /// <param name="Box"></param>
 public void ExtendByBoundingBox(BoundingBox3D Box)
 {
     ExtendByPoint(Box.Min);
     ExtendByPoint(Box.Max);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Typed equals
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool Equals(BoundingBox3D obj)
 {
     return (obj.Min == Min && obj.Max == Max);
 }