コード例 #1
0
ファイル: cities.C プロジェクト: petehawkes/Greenhouse
  Cities ()  :  DataSet ()
    { Load ("data/cities/geonames_cities5000.txt");

      city_name = StrColumn   (0);
      latitude  = FloatColumn (1);
      longitude = FloatColumn (2);

      LoadShaders ("shaders/foggy.vert", "shaders/null.frag");

      for (int64 i = 0  ;  i < Count ()  ;  i++)
        { Vect globe_position = LatLongToSphereSurface (GLOBE_RADIUS,
                                                        latitude[i],
                                                        longitude[i]);
          SetPointLocation (i, globe_position.x,
                               globe_position.y,
                               globe_position.z);

          // INFORM ( city_name[i] + ", "
          //        + ToStr (longitude[i]) + ", "
          //        + ToStr (latitude[i]) );

          SetPointColor (i, HSB (0.12, 0.2, 1.0, 1.0));
          SetPointSize (i, 2.0);
        }
      DataReady ();
    }
コード例 #2
0
ファイル: rgb_hsb2.cpp プロジェクト: hkaiser/TRiAS
unsigned long RGBtoHSB (int iRed, int iGreen, int iBlue)
{
	ASSERT(0 <= iRed && 255 >= iRed);
	ASSERT(0 <= iGreen && 255 >= iGreen);
	ASSERT(0 <= iBlue && 255 >= iBlue);

double dHue = 0.0;
double dSat = 0.0;
double dBright = 0.0;
double dRed = (double)iRed / 255.0;
double dGreen = (double)iGreen / 255.0;
double dBlue = (double)iBlue / 255.0;

	RGBtoHSBService (dRed, dGreen, dBlue, dHue, dSat, dBright);

return HSB((int)((dSat*255.0)+0.5), (int)((dBright*65535.0)+0.5), (int)(((dHue*255.0)/360)+0.5));
}
コード例 #3
0
ファイル: cities.C プロジェクト: petehawkes/Greenhouse
  CountryBorders ()  :  DataSet ()
    { Load ("data/Tissot_indicatrix_world_map_equirectangular_proj_360x180_coords_cleaner2.txt");

      //  Interpret the 0th and 1th column in the data as floats,
      //  and the 2th column as ints
      longitude = FloatColumn (0);
      latitude  = FloatColumn (1);
      drawitude = IntColumn   (2);

      LoadShaders ("shaders/foggy.vert", "shaders/null.frag");

      for (int64 i = 4  ;  i < Count ()  ;  i++)
        { float64 mapped_longitude
            = Range (longitude[i], 0.0, 360.0, -180.0, 180.0) - 0.2;

          //  todo: - .2 because the borders data is a tad off
          float64 mapped_latitude
            = Range (latitude[i], 0.0, 180.0, 90.0, -90.0) + 0.25;

          //  todo: + .25 because the borders data is a tad off

          Vect globe_position = LatLongToSphereSurface (GLOBE_RADIUS - 0.5,
                                                        mapped_latitude,
                                                        mapped_longitude);
          SetPointLocation (i, globe_position.x,
                            globe_position.y,
                            globe_position.z);

          SetPointColor (i, HSB (0.5, 0.0, 0.2, 1.0 * drawitude[i]));
        }

      DataReady ();
      SetDrawMode (GL_LINE_STRIP);

      RotationAnimateChase (0.75);
      TranslationAnimateChase (0.25);
    }