Example #1
0
 public RenderContext()
 {
     for (int i = 0; i < 6; i++)
     {
         frustum[i] = new PlaneD(0,0,0,0);
     }
 }
Example #2
0
        //virtual public bool IsTileInFrustum(PlaneD[]frustum)
        //{
        //    InViewFrustum = false;
        //    Vector3d center = sphereCenter;
        //    if (this.Level < 2 && dataset.Projection == ProjectionType.Mercator)
        //    {
        //        return true;
        //    }
        //    Vector4d centerV4 = new Vector4d(center.X , center.Y , center.Z , 1f);
        //    Vector3d length = Vector3d.Create(sphereRadius, 0, 0);
        //    double rad = length.Length();
        //    for (int i = 0; i < 6; i++)
        //    {
        //        if (frustum[i].Dot(centerV4) + rad < 0)
        //        {
        //            return false;
        //        }
        //    }
        //    InViewFrustum = true;
        //    return true;
        //}
        public virtual bool IsTileInFrustum(PlaneD[] frustum)
        {
            if (this.Level < 2 && (dataset.Projection == ProjectionType.Mercator || dataset.Projection == ProjectionType.Toast))
            {
            //    return true;
            }
            InViewFrustum = false;

            Vector4d centerV4 = new Vector4d(sphereCenter.X, sphereCenter.Y, sphereCenter.Z, 1f);

            for (int i = 0; i < 6; i++)
            {
                if (frustum[i].Dot(centerV4)  < -sphereRadius)
                {
                    return false;
                }
            }
            InViewFrustum = true;

            return true;
        }