Пример #1
0
        ///<summary>获得tile的屏幕2D点</summary>
        public static Vector2[] GetTileCorner(EarthData node, Earth earth)
        {
            Vector2[] v2s = new Vector2[node.normals.Length];
            for (int i = 0; i < node.normals.Length; i++)
            {
                v2s[i] = Helpler.GetProjectPoint2D(node.normals[i], earth.camera.view, earth.camera.projection, earth.global.ScreenWidth, earth.global.ScreenHeight);
            }

            return(v2s);
        }
Пример #2
0
        ///<summary>获得tile的屏幕rect</summary>
        public static Rect GetTileRect(EarthData node, Earth earth)
        {
            Vector2[] v2s = new Vector2[node.normals.Length];
            for (int i = 0; i < node.normals.Length; i++)
            {
                v2s[i] = Helpler.GetProjectPoint2D(node.normals[i], earth.camera.view, earth.camera.projection, earth.global.ScreenWidth, earth.global.ScreenHeight);
            }

            double minx = v2s.Min(p => p.X); double miny = v2s.Min(p => p.Y);
            double maxx = v2s.Max(p => p.X); double maxy = v2s.Max(p => p.Y);

            return(new Rect(minx, miny, maxx - minx, maxy - miny));
        }