Exemplo n.º 1
0
        /// <summary>
        /// 检查当前包围球是否包含指定包围断面锥
        /// </summary>
        /// <param name="frustum">指定包围断面锥</param>
        /// <returns>表明关系的枚举类型</returns>
        public ClipStatus Contains(BoundingFrustum frustum)
        {
            if (null == frustum)
            {
                throw new ArgumentNullException("frustum", FrameworkResources.NullNotAllowed);
            }
            if (!frustum.Intersects(this))
            {
                return(ClipStatus.Outside);
            }
            float num2 = this.Radius * this.Radius;

            foreach (Vector3 vector2 in frustum.cornerArray)
            {
                Vector3 vector;
                vector.X = vector2.X - this.Center.X;
                vector.Y = vector2.Y - this.Center.Y;
                vector.Z = vector2.Z - this.Center.Z;
                if (vector.LengthSquared() > num2)
                {
                    return(ClipStatus.Intersecting);
                }
            }
            return(ClipStatus.Inside);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 检查这个平面是否与指定包围断面锥相交
 /// </summary>
 /// <param name="frustum">指定的包围断面锥</param>
 /// <returns>表明关系的枚举类型</returns>
 public PlaneIntersectionStatus Intersects(BoundingFrustum frustum)
 {
     if (null == frustum)
     {
         throw new ArgumentNullException("frustum", FrameworkResources.NullNotAllowed);
     }
     return frustum.Intersects(this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 检测当前包围台是否与射线相交
 /// </summary>
 /// <param name="frustum">用于检测相交的包围台</param>
 /// <returns>若包围台与射线相交,则返回true;否则,返回false</returns>
 public bool Intersects(BoundingFrustum frustum)
 {
     if (frustum == null)
     {
         throw new ArgumentNullException("frustum");
     }
     return(frustum.Intersects(this));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 检查当前包围球是否与指定包围断面锥相交
        /// </summary>
        /// <param name="frustum">指定包围断面锥 </param>
        /// <returns>相交true,不相交false </returns>
        public bool Intersects(BoundingFrustum frustum)
        {
            bool flag;

            if (null == frustum)
            {
                throw new ArgumentNullException("frustum", FrameworkResources.NullNotAllowed);
            }
            frustum.Intersects(ref this, out flag);
            return(flag);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 检测当前包围盒是否包含指定包围断面锥
 /// </summary>
 /// <param name="frustum">指定的包围断面锥 </param>
 /// <returns>表明关系的枚举类型</returns>
 public ClipStatus Contains(BoundingFrustum frustum)
 {
     if (null == frustum)
     {
         throw new ArgumentNullException("frustum", FrameworkResources.NullNotAllowed);
     }
     if (!frustum.Intersects(this))
     {
         return(ClipStatus.Outside);
     }
     foreach (Vector3 vector in frustum.cornerArray)
     {
         if (this.Contains(vector) == ClipStatus.Outside)
         {
             return(ClipStatus.Intersecting);
         }
     }
     return(ClipStatus.Inside);
 }
Exemplo n.º 6
0
 static public int Intersects(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(ScriptRuntime.Plane)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.Plane           a1;
             checkValueType(l, 2, out a1);
             var ret = self.Intersects(a1);
             pushValue(l, true);
             pushEnum(l, (int)ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.Ray)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.Ray             a1;
             checkValueType(l, 2, out a1);
             var ret = self.Intersects(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.BoundingSphere)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.BoundingSphere  a1;
             checkValueType(l, 2, out a1);
             var ret = self.Intersects(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.BoundingBox)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.BoundingBox     a1;
             checkValueType(l, 2, out a1);
             var ret = self.Intersects(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.BoundingFrustum)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.BoundingFrustum a1;
             checkType(l, 2, out a1);
             var ret = self.Intersects(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.Plane), typeof(LuaOut)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.Plane           a1;
             checkValueType(l, 2, out a1);
             ScriptRuntime.PlaneIntersectionStatus a2;
             self.Intersects(ref a1, out a2);
             pushValue(l, true);
             pushValue(l, a1);
             pushValue(l, a2);
             return(3);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.Ray), typeof(LuaOut)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.Ray             a1;
             checkValueType(l, 2, out a1);
             System.Single a2;
             var           ret = self.Intersects(ref a1, out a2);
             pushValue(l, true);
             pushValue(l, ret);
             pushValue(l, a1);
             pushValue(l, a2);
             return(4);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.BoundingBox), typeof(LuaOut)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.BoundingBox     a1;
             checkValueType(l, 2, out a1);
             System.Boolean a2;
             self.Intersects(ref a1, out a2);
             pushValue(l, true);
             pushValue(l, a1);
             pushValue(l, a2);
             return(3);
         }
         else if (matchType(l, argc, 2, typeof(ScriptRuntime.BoundingSphere), typeof(LuaOut)))
         {
             ScriptRuntime.BoundingFrustum self = (ScriptRuntime.BoundingFrustum)checkSelf(l);
             ScriptRuntime.BoundingSphere  a1;
             checkValueType(l, 2, out a1);
             System.Boolean a2;
             self.Intersects(ref a1, out a2);
             pushValue(l, true);
             pushValue(l, a1);
             pushValue(l, a2);
             return(3);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }