Esempio n. 1
0
 //Draws the actual map texture
 internal void drawHeightScanline(SCANtype type)
 {
     Color[] cols_height_map_small = map_small.GetPixels(0, scanline, 360, 1);
     for (int ilon = 0; ilon < 360; ilon += 1)
     {
         int   scheme = SCANcontroller.controller.colours;
         float val    = heightmap[ilon, scanline];
         if (val == 0)
         {                 //Some preparation for bigger changes in map caching, automatically calculate elevation for every point on the small map, only display scanned areas
             if (body.pqsController == null)
             {
                 heightmap[ilon, scanline]   = 0;
                 cols_height_map_small[ilon] = palette.lerp(palette.black, palette.white, UnityEngine.Random.value);
                 continue;
             }
             else
             {
                 // convert to radial vector
                 val = (float)SCANUtil.getElevation(body, ilon - 180, scanline - 90);
                 if (val == 0)
                 {
                     val = -0.001f;                             // this is terrible
                 }
                 heightmap[ilon, scanline] = val;
             }
         }
         Color c = palette.black;
         if (SCANUtil.isCovered(ilon, scanline, this, SCANtype.Altimetry))
         {                 //We check for coverage down here now, after elevation data is collected
             if (SCANUtil.isCovered(ilon, scanline, this, SCANtype.AltimetryHiRes))
             {
                 c = palette.heightToColor(val, scheme, this);
             }
             else
             {
                 c = palette.heightToColor(val, 1, this);
             }
         }
         else
         {
             c = palette.grey;
             if (scanline % 30 == 0 && ilon % 3 == 0)
             {
                 c = palette.white;
             }
             else if (ilon % 30 == 0 && scanline % 3 == 0)
             {
                 c = palette.white;
             }
         }
         if (type != SCANtype.Nothing)
         {
             if (!SCANUtil.isCoveredByAll(ilon, scanline, this, type))
             {
                 c = palette.lerp(c, palette.black, 0.5f);
             }
         }
         cols_height_map_small[ilon] = c;
     }
     map_small.SetPixels(0, scanline, 360, 1, cols_height_map_small);
     scanline = scanline + 1;
     if (scanline >= 180)
     {
         scanstep += 1;
         scanline  = 0;
     }
 }