コード例 #1
0
ファイル: HitableList.cs プロジェクト: bschne/RaySharp
        public override bool BoundingBox(double t0, double t1, out AxisAlignedBoundingBox boundingBox)
        {
            if (_list.Count < 1)
            {
                boundingBox = null;
                return(false);
            }

            AxisAlignedBoundingBox tempBox;

            bool firstTrue = _list[0].BoundingBox(t0, t1, out tempBox);

            if (!firstTrue)
            {
                boundingBox = null;
                return(false);
            }
            else
            {
                boundingBox = tempBox;
            }

            for (int i = 0; i < _list.Count; i++)
            {
                if (_list[i].BoundingBox(t0, t1, out tempBox))
                {
                    boundingBox = AxisAlignedBoundingBox.SurroundingBox(boundingBox, tempBox);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }