Exemplo n.º 1
0
        public PairIntDouble[] GetTerrainAndBiome(Coordinates[] coords)
        {
            DebugUtils.Assert(!ThreadDispatcher.IsMainThread);
            PairIntDouble[] ret = new PairIntDouble[coords.Length];

            ThreadDispatcher.QueueToMainThreadSync(() =>
            {
                for (int i = 0; i < coords.Length; i++)
                {
                    double lon = coords[i].Longitude;
                    double lat = coords[i].Latitude;

                    double alt = Body.pqsController.GetSurfaceHeight(Body.GetRelSurfaceNVector(lat * 180 / Math.PI, lon * 180 / Math.PI)) - Body.Radius;
                    int biome  = -1;

                    if (Body.BiomeMap)
                    {
                        var attr = Body.BiomeMap.GetAtt(lat, lon);
                        for (int k = 0, n = Body.BiomeMap.Attributes.Length; k < n; k++)
                        {
                            if (attr == Body.BiomeMap.Attributes[k])
                            {
                                biome = k;
                                break;
                            }
                        }
                    }

                    ret[i] = new PairIntDouble(biome, alt);
                }
            });


            return(ret);
        }
Exemplo n.º 2
0
        public PairIntDouble[] GetTerrainAndBiome(Coordinates[] coords)
        {
            DebugUtils.Assert(!ThreadDispatcher.IsMainThread);
            PairIntDouble[] ret = new PairIntDouble[coords.Length];

            ThreadDispatcher.QueueToMainThreadSync(() =>
            {
                for(int i = 0; i < coords.Length; i++)
                {
                    double lon = coords[i].Longitude;
                    double lat = coords[i].Latitude;

                    double alt = Body.pqsController.GetSurfaceHeight(Body.GetRelSurfaceNVector(lat * 180 / Math.PI, lon * 180 / Math.PI)) - Body.Radius;
                    int biome = -1;

                    if (Body.BiomeMap)
                    {
                        var attr = Body.BiomeMap.GetAtt(lat, lon);
                        for (int k = 0, n = Body.BiomeMap.Attributes.Length; k < n; k++)
                        {
                            if (attr == Body.BiomeMap.Attributes[k])
                            {
                                biome = k;
                                break;
                            }
                        }
                    }

                    ret[i] = new PairIntDouble(biome, alt);
                }
            });

            return ret;
        }