You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
(5) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(3) |
Sep
|
Oct
|
Nov
(19) |
Dec
(14) |
| 2008 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(56) |
Jul
(25) |
Aug
(4) |
Sep
(20) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(9) |
Feb
(18) |
Mar
|
Apr
(28) |
May
(30) |
Jun
(4) |
Jul
|
Aug
|
Sep
(3) |
Oct
(3) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(13) |
Apr
(1) |
May
(8) |
Jun
|
Jul
|
Aug
(5) |
Sep
(7) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2012 |
Jan
(26) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(31) |
Sep
(4) |
Oct
(4) |
Nov
(1) |
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
(9) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(6) |
Sep
(3) |
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Brian S. <bjs...@us...> - 2015-06-30 15:50:58
|
Update of /cvsroot/atlas/Atlas/src/data/Palettes In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21685/src/data/Palettes Modified Files: GMT_globe.ap NGDC.ap cd-a.ap default.ap wiki-1.03.ap Log Message: Added extra water materials, as suggested by Fabrice Bellet (needed for version 2.0 scenery). Index: wiki-1.03.ap =================================================================== RCS file: /cvsroot/atlas/Atlas/src/data/Palettes/wiki-1.03.ap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wiki-1.03.ap 1 Feb 2012 04:35:07 -0000 1.2 +++ wiki-1.03.ap 30 Jun 2015 15:50:56 -0000 1.3 @@ -67,6 +67,13 @@ Material IntermittentReservoir water Material Stream water Material Ocean water +Material Littoral water +Material Estuary water +Material Pond water +Material Canal water +Material Lagoon water +Material Watercourse water +Material Saline water Material Urban city Material Town city Index: default.ap =================================================================== RCS file: /cvsroot/atlas/Atlas/src/data/Palettes/default.ap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- default.ap 1 Feb 2012 04:35:07 -0000 1.2 +++ default.ap 30 Jun 2015 15:50:56 -0000 1.3 @@ -109,6 +109,13 @@ Material IntermittentReservoir water Material Stream water Material Ocean water +Material Littoral water +Material Estuary water +Material Pond water +Material Canal water +Material Lagoon water +Material Watercourse water +Material Saline water Material Urban city Material Town city Index: GMT_globe.ap =================================================================== RCS file: /cvsroot/atlas/Atlas/src/data/Palettes/GMT_globe.ap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GMT_globe.ap 1 Feb 2012 04:35:07 -0000 1.2 +++ GMT_globe.ap 30 Jun 2015 15:50:56 -0000 1.3 @@ -73,6 +73,13 @@ Material IntermittentReservoir water Material Stream water Material Ocean water +Material Littoral water +Material Estuary water +Material Pond water +Material Canal water +Material Lagoon water +Material Watercourse water +Material Saline water Material Urban city Material Town city Index: NGDC.ap =================================================================== RCS file: /cvsroot/atlas/Atlas/src/data/Palettes/NGDC.ap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NGDC.ap 1 Feb 2012 04:35:07 -0000 1.2 +++ NGDC.ap 30 Jun 2015 15:50:56 -0000 1.3 @@ -57,6 +57,13 @@ Material IntermittentReservoir water Material Stream water Material Ocean water +Material Littoral water +Material Estuary water +Material Pond water +Material Canal water +Material Lagoon water +Material Watercourse water +Material Saline water Material Urban city Material Town city Index: cd-a.ap =================================================================== RCS file: /cvsroot/atlas/Atlas/src/data/Palettes/cd-a.ap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cd-a.ap 1 Feb 2012 04:35:07 -0000 1.2 +++ cd-a.ap 30 Jun 2015 15:50:56 -0000 1.3 @@ -123,6 +123,13 @@ Material IntermittentReservoir water Material Stream water Material Ocean water +Material Littoral water +Material Estuary water +Material Pond water +Material Canal water +Material Lagoon water +Material Watercourse water +Material Saline water Material Urban city Material Town city |
|
From: Brian S. <bjs...@us...> - 2014-10-02 00:39:20
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20249/src Modified Files: AtlasWindow.cxx AtlasWindow.hxx Background.cxx Bucket.cxx Bucket.hxx Overlays.cxx Scenery.cxx Scenery.hxx Subbucket.cxx Subbucket.hxx Log Message: Got rid of using GL_SELECT to do live scenery intersection testing. Some flavours of Linux don't implement GL_SELECT in the hardware driver, resulting in massive slowdowns. And it makes for simpler code in the end. Index: Bucket.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Bucket.hxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Bucket.hxx 27 Jul 2014 05:14:58 -0000 1.15 +++ Bucket.hxx 2 Oct 2014 00:39:17 -0000 1.16 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack A bucket object can load and draw a bucket, which is a basic unit of FlightGear scenery. Buckets are 1/8 degree high, and anywhere from @@ -84,9 +84,6 @@ void draw(); - bool intersection(SGVec3<double> near, SGVec3<double> far, - SGVec3<double> *c); - protected: SGPath _p; // Our scenery directory. long int _index; // Bucket index. Index: AtlasWindow.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AtlasWindow.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- AtlasWindow.cxx 19 Aug 2014 03:25:00 -0000 1.11 +++ AtlasWindow.cxx 2 Oct 2014 00:39:17 -0000 1.12 @@ -3165,9 +3165,7 @@ const sgdFrustum &frustum, const sgdMat4 &m, atlasFntTexFont *fnt, bool magTrue) { - glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_POINT_BIT); { - glDisable(GL_DEPTH_TEST); - + glPushAttrib(GL_POINT_BIT); { if (active) { glColor3f(1.0, 0.0, 0.0); } else { @@ -3248,8 +3246,8 @@ // // EYE - make into an overlay? Combine with flight tracks? // vector<Route> routes; -ScreenLocation::ScreenLocation(Scenery *scenery): - _scenery(scenery), _valid(false), _validElevation(false) +ScreenLocation::ScreenLocation(GLUTWindow *win): + _win(win), _valid(false), _validElevation(false) { } @@ -3270,14 +3268,8 @@ { if (!_valid) { SGVec3<double> cart; - // EYE - Should scenery be an overlay? - _valid = _scenery->intersection(_x, _y, &cart, &_validElevation); - if (_valid) { - _loc.set(cart); - } else { - // We don't throw an error - the user needs to check _loc - _loc.invalidate(); - } + _valid = _intersection(_x, _y, &cart, &_validElevation); + _loc.set(cart); } return _loc; @@ -3296,6 +3288,168 @@ _valid = _validElevation = false; } +// Returns the cartesian coordinates of the world at the screen x, y +// point. Returns true if there is an intersection, false otherwise. +// If we have an elevation value for the intersection then +// validElevation will be set to true (live scenery provides us with +// elevation information, but scenery textures do not). +// +// If we return true, then c contains the coordinates of the surface +// of the earth at <x, y>. If we have lives scenery, the elevation of +// those coordinates is valid. If we return false, then c contains +// the coordinates of a point in space. That point is on a plane +// going through the centre of the earth and parallel to the screen. +// +// We calculate the intersection in three different ways, depending on +// if we have live scenery or not, and whether we intersect the earth +// or not. With live scenery, we find out where the ray intersects +// the scenery, returning the cartesian coordinates of that point. +// With textures, we intersect with an idealized earth ellipsoid. +// When the ray doesn't intersect the earth, we just calculate the +// cartesian coordinates of the point at <x, y, 1.0> (where z = 1.0 is +// the far depth plane, presumed to run through the centre of the +// earth). +// +// x and y are window coordinates which represent a point, not a +// pixel. For example, if a window is 100 pixels wide and 50 pixels +// high, the lower right *pixel* is (99, 49). However, the *point* +// (99.0, 49.0) is the top left corner of that pixel. The lower right +// corner of the entire window is (100.0, 50.0). If you are calling +// this with a mouse coordinate, you probably should add 0.5 to both +// the x and y coordinates, which is the centre of the pixel the mouse +// is on. +bool ScreenLocation::_intersection(float x, float y, SGVec3<double> *c, + bool *validElevation) +{ + GLint viewport[4]; + GLdouble mvmatrix[16], projmatrix[16]; + GLdouble wx, wy, wz; // World x, y, z coords. + + // Make sure we're the active window. + int oldWindow = _win->set(); + + // Our line is given by two points: the intersection of our + // viewing "ray" with the near depth plane and far depth planes. + // This assumes that we're using an orthogonal projection - in a + // perspective projection, we'd use our eyepoint as one of the + // points and the near depth plane as the other. + glGetIntegerv(GL_VIEWPORT, viewport); + glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix); + glGetDoublev(GL_PROJECTION_MATRIX, projmatrix); + + // We need to convert from window coordinates, where y increases + // down, to viewport coordinates, where y increases up. + y = _win->height() - y; + + // Near depth plane intersection. + gluUnProject (x, y, 0.0, mvmatrix, projmatrix, viewport, &wx, &wy, &wz); + SGVec3<double> nnear(wx, wy, wz); + + // Far depth plane intersection. + gluUnProject (x, y, 1.0, mvmatrix, projmatrix, viewport, &wx, &wy, &wz); + SGVec3<double> ffar(wx, wy, wz); + + // If validElevation is not NULL, that means the caller is + // interested in a valid elevation result, which means we must + // query our depth buffer. + if (validElevation != NULL) { + // For now, assume that no buckets intersect. + *validElevation = false; + + // Make sure the screen coordinates are valid - glReadPixels + // doesn't report errors if they're out of range. + if ((x >= 0) && (x < _win->width()) && + (y >= 0) && (y < _win->height())) { + GLfloat z; + glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); + // EYE - this really should be a global constant. + GLfloat clearValue = 1.0; + // EYE - calling this causes significant slowdown + // glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearValue); + if (z < clearValue) { + *validElevation = true; + + gluUnProject(x, y, z, + mvmatrix, projmatrix, viewport, + &wx, &wy, &wz); + c->x() = wx; + c->y() = wy; + c->z() = wz; + } + } + } + // EYE - check and copy any useful documentation from Scenery, + // Bucket, ... intersection() methods. Also make sure that we + // always get called when the window is active. + + // Beyond this point, we don't do any OpenGL stuff, so we can + // restore the old active window. + _win->set(oldWindow); + + // If the user was interested in getting an elevation and we + // actually got one, we can return now. + if ((validElevation != NULL) && *validElevation) { + return true; + } + + // If we got here, that means no tiles intersected or the user + // isn't interested in an elevation. So, we'll just use a simple + // earth/ray intersection with a standard earth ellipsoid. This + // will give us the lat/lon, but the elevation will always be 0 + // (sea level). + // + // We stretch the universe along the earth's axis so that the + // earth is a sphere. This code assumes that the earth is centred + // at the origin, and that the earth's axis is aligned with the z + // axis, north positive. + // + // This website: + // + // http://mysite.du.edu/~jcalvert/math/ellipse.htm + // + // has a good explanation of ellipses, including the statement "The + // ellipse is just this auxiliary circle with its ordinates shrunk in the + // ratio b/a", where a is the major axis (equatorial plane), and b is + // the minor axis (axis of rotation). + assert((validElevation == NULL) || (*validElevation == false)); + SGVec3<double> centre(0.0, 0.0, 0.0); + double mu1, mu2; + nnear[2] *= SGGeodesy::STRETCH; + ffar[2] *= SGGeodesy::STRETCH; + if (RaySphere(nnear, ffar, centre, SGGeodesy::EQURAD, &mu1, &mu2)) { + SGVec3<double> s1, s2; + s1 = nnear + mu1 * (ffar - nnear); + s2 = nnear + mu2 * (ffar - nnear); + + // Take the nearest intersection (the other is on the other + // side of the world). + if (dist(nnear, s1) < dist(nnear, s2)) { + // Unstretch the world. + s1[2] /= SGGeodesy::STRETCH; + *c = s1; + } else { + // Unstretch the world. + s2[2] /= SGGeodesy::STRETCH; + *c = s2; + } + + return true; + } else { + // We don't intersect the earth at all, so just report the + // cartesian coordinates of the point <x, y, 1.0>. Note - + // this assumes the centre of the earth lies on the far depth + // plane, which lies at z = 1.0. + GLfloat z = 1.0; + gluUnProject(x, y, z, + mvmatrix, projmatrix, viewport, + &wx, &wy, &wz); + c->x() = wx; + c->y() = wy; + c->z() = wz; + return false; + } +} + AtlasWindow::AtlasWindow(const char *name, const char *regularFontFile, const char *boldFontFile, @@ -3306,10 +3460,11 @@ _renderDialog(NULL), _renderConfirmDialog(NULL), _dispatcher(NULL), _searchTimerScheduled(false) { - // Initialize OpenGL, starting with clearing (background) color - // and enabling depth testing. + // EYE - check which of these are defaults already? For example, + // by default the clearing colour is (0.0, 0.0, 0.0, 0.0). + + // Initialize OpenGL, starting with clearing (background) colour. glClearColor(0.0, 0.0, 0.0, 0.0); - glEnable(GL_DEPTH_TEST); // Turn on backface culling. We use the OpenGL standard of // counterclockwise winding for front faces. @@ -3361,8 +3516,8 @@ // Create our screen location objects. They track the lat/lon // (and elevation, if available) of what's beneath the cursor and // the centre of the screen, respectively. - _cursor = new ScreenLocation(_scenery); - _centre = new ScreenLocation(_scenery); + _cursor = new ScreenLocation(this); + _centre = new ScreenLocation(this); // Create our overlays and initialize them. _overlays = new Overlays(this); @@ -3579,7 +3734,7 @@ // globals.str.printf("%.0f frames/s", (float)times.size() / t); // EYE - create a "write text on screen" method in AtlasWindow? - glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_TRANSFORM_BIT); { + glPushAttrib(GL_CURRENT_BIT | GL_TRANSFORM_BIT); { glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); @@ -3589,7 +3744,6 @@ glLoadIdentity(); glColor4f(0.0, 0.0, 0.0, 1.0); - glDisable(GL_DEPTH_TEST); glRasterPos2i(10, height() - 25); for (const char *c = fpsStr.str(); *c; c++) { // for (const char *c = globals.str.str(); *c; c++) { @@ -3653,11 +3807,10 @@ switch (button) { case GLUT_LEFT_BUTTON: if (state == GLUT_DOWN) { - if (_scenery->intersection(x, y, &_oldC)) { - // EYE - do we need to set _dragging here, or - // should we wait until mouseMotion gets called? - _dragging = true; - } + _oldC = cursor()->cart(); + // EYE - do we need to set _dragging here, or + // should we wait until mouseMotion gets called? + _dragging = true; } else { _dragging = false; } @@ -3695,29 +3848,27 @@ if (_dragging) { SGVec3<double> newC; - if (_scenery->intersection(x, y, &newC)) { - // The two vectors, _oldC and newC, define the plane and - // angle of rotation. A line perpendicular to this plane, - // passing through the origin, is our axis of rotation. - // However, if the two vectors are the same, there is no - // motion (nor do they define a plane), so we just return - // immediately. - if (_oldC == newC) { - return; - } + newC = cursor()->cart(); + // The two vectors, _oldC and newC, define the plane and angle + // of rotation. A line perpendicular to this plane, passing + // through the origin, is our axis of rotation. However, if + // the two vectors are the same, there is no motion (nor do + // they define a plane), so we just return immediately. + if (_oldC == newC) { + return; + } - sgdVec3 axis; - sgdMat4 rot; + sgdVec3 axis; + sgdMat4 rot; - sgdVectorProductVec3(axis, newC.data(), _oldC.data()); - double theta = SGD_RADIANS_TO_DEGREES * - atan2(sgdLengthVec3(axis), - sgdScalarProductVec3(_oldC.data(), newC.data())); - sgdMakeRotMat4(rot, theta, axis); + sgdVectorProductVec3(axis, newC.data(), _oldC.data()); + double theta = SGD_RADIANS_TO_DEGREES * + atan2(sgdLengthVec3(axis), + sgdScalarProductVec3(_oldC.data(), newC.data())); + sgdMakeRotMat4(rot, theta, axis); - // Transform the eye point and the camera up vector. - rotatePosition(rot); - } + // Transform the eye point and the camera up vector. + rotatePosition(rot); } else if (puMouse(x, y)) { postRedisplay(); } @@ -4698,6 +4849,13 @@ { _metresPerPixel = scale; + // A note about the use of the far clip plane: We set the far clip + // plane to the centre of the earth. This gives us a cheap and + // reliable way to do hidden surface removal, since everything + // beyond a plane parallel to the screen passing through the + // earth's centre is on the other side of the earth and therefore + // not visible. + // Calculate clip planes. Why 'nnear' and 'ffar', not 'near' and // 'far'? Windows. double left, right, bottom, top, nnear, ffar; @@ -4956,9 +5114,7 @@ SGGeod centreGeod; SGVec3<double> centreCart; - bool foo; - _scenery->intersection(_centre->x(), _centre->y(), ¢reCart, - &foo); + centreCart = centre()->cart(); SGGeodesy::SGCartToGeod(centreCart, centreGeod); printf("%.8f, %.8f, %f (%f metres)\n", @@ -4982,8 +5138,7 @@ lookAtCart[0], lookAtCart[1], lookAtCart[2], eyeUp()[0], eyeUp()[1], eyeUp()[2]); - _scenery->intersection(_centre->x(), _centre->y(), ¢reCart, - &foo); + centreCart = centre()->cart(); SGGeodesy::SGCartToGeod(centreCart, centreGeod); printf("\t%.8f, %.8f, %f (%f metres)\n", Index: Scenery.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Scenery.hxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Scenery.hxx 24 Aug 2012 23:22:55 -0000 1.14 +++ Scenery.hxx 2 Oct 2014 00:39:17 -0000 1.15 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2008 - 2012 Brian Schack + Copyright (C) 2008 - 2014 Brian Schack The scenery object is responsible for loading and displaying scenery, whether that scenery comes in the form of pre-rendered maps @@ -117,23 +117,6 @@ // Tells us that the tile's status has changed. void update(Tile *t); - // Calculates the intersection of the viewing ray that goes - // through the window at <x, y> with the earth, returning true if - // the ray intersects the earth (in which case c contains the - // point of intersection). If it intersects with live scenery, - // then validElevation (if it is non-null) is set to true, and the - // elevation in c is the actual elevation at that point. If - // validElevation is false, then the elevation in c is the - // elevation with the earth ellipsoid. x and y use window - // coordinates, with <0.0, 0.0> at the top left corner, and <w, h> - // at the bottom right corner (where w and h are the window width - // and height respectively). - - // EYE - we should also return the bucket id so that we can - // quickly get map information. - bool intersection(double x, double y, SGVec3<double> *c, - bool *validElevation = NULL); - protected: // Draws MEF labels on the scenery. void _label(bool live); Index: Background.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Background.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Background.cxx 3 Dec 2013 05:10:06 -0000 1.6 +++ Background.cxx 2 Oct 2014 00:39:17 -0000 1.7 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 - 2013 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This file is part of Atlas. @@ -255,12 +255,7 @@ glBindTexture(GL_TEXTURE_2D, _statusTexture); //////////////////////////////////////////////////////////// - // Stitch the texture to the globe. We move the - // background world back slightly so that the scenery, - // when draped over the world, is not obscured by this - // texture map. - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1.0, 1.0); + // Stitch the texture to the globe. // Specify the vertices. glEnableClientState(GL_VERTEX_ARRAY); @@ -324,8 +319,6 @@ if (currentLoc->coord().valid()) { glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); glPushAttrib(GL_ENABLE_BIT | GL_LINE_BIT); { - // EYE - get rid of depth test everywhere? - glDisable(GL_DEPTH_TEST); glLineWidth(2.0); // Tell OpenGL where the vertex data is and enable Index: Bucket.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Bucket.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Bucket.cxx 27 Jul 2014 05:14:58 -0000 1.17 +++ Bucket.cxx 2 Oct 2014 00:39:17 -0000 1.18 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -172,73 +172,3 @@ _subbuckets[i]->draw(); } } - -// Checks if the ray defined by points near and far intersect this -// bucket. If it does, then the intersection is placed into c. - -// EYE - still not good enough! Need to mention the viewing frustum, -// and why we need to pass near and far and how they should be -// defined. Should the RaySphere test be moved out? (Because it may -// not be 100% reliable, and/or because it belongs higher up). -bool Bucket::intersection(SGVec3<double> nnear, SGVec3<double> ffar, - SGVec3<double> *c) -{ - // We don't try to do a "live" intersection unless we've actually - // loaded the scenery. - if (!_loaded) { - return false; - } - - // As a first quick check, we see if it intersects our bounding - // sphere. If it does, we need to do a more detailed check. - double mu1, mu2; - // EYE - is this doing a cast or a copy? And check this elsewhere. - - // EYE - is it possible to *not* intersect the bounding sphere but - // to intersect the bucket? We should check carefully how the - // bounding sphere is defined. - if (!RaySphere(nnear, ffar, SGVec3<double>(_bounds.center), _bounds.radius, - &mu1, &mu2)) { - // Doesn't intersect our bounding sphere, so return false - // immediately. - return false; - } - - // It intersects our bounding sphere - we need to draw the scene - // in select mode and see if we get any hits. We don't care about - // the identities of anything that intersects - just the minimum - // depth value recorded, which is placed in selectBuf[1]. - GLuint selectBuf[3]; - glSelectBuffer(3, selectBuf); - glRenderMode(GL_SELECT); - - // Now "draw" the bucket. - glMatrixMode(GL_MODELVIEW); - draw(); - - // Any hits? - int hits = glRenderMode(GL_RENDER); - assert(hits <= 1); - if (hits == 0) { - // Nope. - return false; - } - - // We got a hit, meaning our picking frustum intersects some part - // of our bucket. We want the highest point in that intersection. - // To make our life easy, we make two simplifying assumptions: (1) - // We are looking straight down on the bucket (not exactly true, - // but close enough), and (2) The bucket is not curved (also not - // exactly true, but close enough). - // - // Given these assumptions, the highest point is the nearest z - // value, which is given in the hit record at offset 1. Note that - // OpenGL applies a scaling factor of 2^32-1 to z values, where z - // = 0 at the near plane, and 2^32-1 at the far plane. - const double scale = (double)numeric_limits<GLuint>::max(); - double minZ = selectBuf[1] / scale; - - *c = (ffar - nnear) * minZ + nnear; - - return true; -} Index: AtlasWindow.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AtlasWindow.hxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AtlasWindow.hxx 6 Mar 2014 00:00:17 -0000 1.6 +++ AtlasWindow.hxx 2 Oct 2014 00:39:17 -0000 1.7 @@ -95,16 +95,17 @@ ////////////////////////////////////////////////////////////////////// // // ScreenLocation maintains a window x, y coordinate, and its -// corresponding location on the earth (which it determines using a -// Scenery object). ScreenLocation does not track changes to the -// view, so it must be told when to recalculate its location, via the +// corresponding location on the earth (which it determines using the +// depth buffer of the map window, which should be passed in the +// constructor). ScreenLocation does not track changes to the view, +// so it must be told when to recalculate its location, via the // invalidate() call. // ////////////////////////////////////////////////////////////////////// class ScreenLocation { public: - ScreenLocation(Scenery *scenery); - // ScreenLocation(ScreenLocation &loc); + ScreenLocation(GLUTWindow *win); + // ScreenLocation(ScreenLocation &loc): // Set x, y. This also causes us to be invalidated. void set(float x, float y); @@ -134,17 +135,32 @@ void invalidate(); protected: - // We use this to figure out what's beneath our given screen + // Calculates the intersection of the viewing ray that goes + // through the window at <x, y> with the earth, returning true if + // the ray intersects the earth (in which case c contains the + // point of intersection). If it returns false, c represents the + // point in world space at <x, y, 1.0>, which is on the plane + // going through the earth's centre (the far clip plane). If it + // intersects with live scenery, then validElevation (if it is + // non-null) is set to true, and the elevation in c is the actual + // elevation at that point. If validElevation is false, then the + // elevation in c is the elevation with the earth ellipsoid. x + // and y use window coordinates, with <0.0, 0.0> at the top left + // corner, and <w, h> at the bottom right corner (where w and h + // are the window width and height respectively). + bool _intersection(float x, float y, SGVec3<double> *c, + bool *validElevation); + + // We use the depth buffer of the map window to figure out the + // geographic coordinates of what's beneath our given screen // coordinates. - Scenery *_scenery; + GLUTWindow *_win; - // Note that both ScreenLocation and AtlasCoord have notions of - // validity. When the ScreenLocation is valid (_valid = true), - // that means we've called intersection() with the current x, y - // coordinates. When the AtlasCoord is valid (_loc.valid() = - // true), that means the intersection hit the earth. Finally, - // _validElevation tells us if the intersection was with live - // scenery. + // Note that we have two notions of validity. When the + // ScreenLocation is valid (_valid = true), that means we've + // called intersection() with the current x, y coordinates. When + // _validElevation is true, the intersection was with live + // scenery, and so the elevation is usable. bool _valid, _validElevation; float _x, _y; AtlasCoord _loc; Index: Subbucket.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Subbucket.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Subbucket.cxx 18 Sep 2014 04:04:31 -0000 1.20 +++ Subbucket.cxx 2 Oct 2014 00:39:17 -0000 1.21 @@ -442,7 +442,7 @@ // _vertices[i * 3 + 1], and _vertices[i * 3 + 2] (ditto for // the ith normal). index *= 3; - v *= 3; + // Now convert the point using the given projection. if (projection == Bucket::CARTESIAN) { // This is a true 3D rendering. @@ -803,12 +803,18 @@ indices.draw(); } + // EYE - To reduce the number of times we turn the depth test + // on and off (assuming that slows things down), we might want + // to have separate draw() methods, one for materials and + // contours (which use the depth buffer), another for contour + // lines and polygon edges (which don't). + // ---------- Contour lines ---------- NormalVBO::disable(); ColourVBO::disable(); if (Bucket::contourLines) { glPushAttrib(GL_LINE_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT); { - glDisable(GL_DEPTH_TEST); + glDisable(GL_DEPTH_TEST); glLineWidth(0.5); glColor4f(0.0, 0.0, 0.0, 1.0); _contourLines.draw(); @@ -819,8 +825,8 @@ // ---------- Polygon edges ---------- if (Bucket::polygonEdges) { glPushAttrib(GL_LINE_BIT | GL_POLYGON_BIT | GL_CURRENT_BIT | - GL_DEPTH_BUFFER_BIT); { - glDisable(GL_DEPTH_TEST); + GL_DEPTH_BUFFER_BIT); { + glDisable(GL_DEPTH_TEST); glPolygonMode(GL_FRONT, GL_LINE); glLineWidth(0.5); glColor4f(1.0, 0.0, 0.0, 1.0); Index: Scenery.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Scenery.cxx,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- Scenery.cxx 27 Jul 2014 05:14:58 -0000 1.40 +++ Scenery.cxx 2 Oct 2014 00:39:17 -0000 1.41 @@ -727,25 +727,6 @@ } } -// Returns true if the ray given by a and b intersects a bucket in -// this tile. The point of intersection is given in c. Note that if -// no buckets are loaded, we just return false. -bool SceneryTile::intersection(SGVec3<double> a, SGVec3<double> b, - SGVec3<double> *c) -{ - if (_buckets == NULL) { - return false; - } - - for (unsigned int i = 0; i < _buckets->size(); i++) { - if ((*_buckets)[i]->intersection(a, b, c)) { - return true; - } - } - - return false; -} - // This requests that we fill our _buckets array. If we've done so // already, we just return immediately. Otherwise we search the // scenery directory for the buckets that compose this tile, adding @@ -917,9 +898,9 @@ void Scenery::draw(bool lightingOn) { - // We assume that when called, the depth test is on and lighting - // is off. - assert(glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); + // We assume that when called, the depth test and lighting are + // off. + assert(!glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); // Has our view of the world changed? if (_dirty) { @@ -974,15 +955,12 @@ glEnable(GL_LIGHTING); } - // Clear depth buffer. Generally scenery tiles will be in - // front of textures, because textures are drawn at sea level - // and scenery is above sea level, so this usually isn't - // necessary. However, in some places, like the Dead Sea, the - // scenery is below sea level. By clearing the depth buffer, - // we ensure that the scenery will be drawn over anything - // that's already there. - glClear(GL_DEPTH_BUFFER_BIT); - + // We enable the depth test, mostly to gather information on + // scenery elevations. I suppose there's a chance that some + // bits of the scenery might be occluded by other bits, but I + // think that's actually unlikely (does FlightGear have + // caves?). + glEnable(GL_DEPTH_TEST); for (unsigned int i = 0; i < intersections.size(); i++) { SceneryTile *t = dynamic_cast<SceneryTile *>(intersections[i]); if (!t) { @@ -990,6 +968,7 @@ } t->drawBuckets(); } + glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); } @@ -1026,185 +1005,17 @@ // This should have been taken care of in draw(). assert(!_dirty); - // We assume that when called, the depth test is on, and lighting - // is off. - assert(glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); - - // Labels must be written on top of whatever scenery is there, so - // we ignore depth values. - glPushAttrib(GL_DEPTH_BUFFER_BIT); { - glDisable(GL_DEPTH_TEST); - - // Draw elevation figures. - const vector<Cullable *>& intersections = _frustum->intersections(); - for (unsigned int i = 0; i < intersections.size(); i++) { - SceneryTile *t = dynamic_cast<SceneryTile *>(intersections[i]); - if (!t) { - continue; - } - t->label(_metresPerPixel, live); - } - } - glPopAttrib(); -} - -// Returns the cartesian coordinates of the world at the screen x, y -// point. Returns true if there is an intersection (in which case c -// contains the intersection coordinates), false otherwise. If we -// have an elevation value for the intersection then validElevation -// will be set to true (live scenery provides us with elevation -// information, but scenery textures do not). -// -// We calculate the intersection in two different ways, depending on -// if we have live scenery or not. With live scenery, we find out -// where the ray intersects the scenery, returning the cartesian -// coordinates of that point. With textures, we intersect with an -// idealized earth ellipsoid. -// -// x and y are window coordinates which represent a point, not a -// pixel. For example, if a window is 100 pixels wide and 50 pixels -// high, the lower right *pixel* is (99, 49). However, the *point* -// (99.0, 49.0) is the top left corner of that pixel. The lower right -// corner of the entire window is (100.0, 50.0). If you are calling -// this with a mouse coordinate, you probably should add 0.5 to both -// the x and y coordinates, which is the centre of the pixel the mouse -// is on. -// -// Note as well that if we intersect with live scenery, the elevation -// value will be the maximum value in the 1x1 pixel area centred on -// (x, y). -bool Scenery::intersection(double x, double y, - SGVec3<double> *c, bool *validElevation) -{ - // EYE - we should set the window ourselves (which means saving it - // in the constructor). Then this method could be called safely - // from anywhere. - GLint viewport[4]; - GLdouble mvmatrix[16], projmatrix[16]; - GLdouble wx, wy, wz; // World x, y, z coords. - - // Make sure we're the active window. - int oldWindow = _aw->set(); - - // Our line is given by two points: the intersection of our - // viewing "ray" with the near depth plane and far depth planes. - // This assumes that we're using an orthogonal projection - in a - // perspective projection, we'd use our eyepoint as one of the - // points and the near depth plane as the other. - glGetIntegerv(GL_VIEWPORT, viewport); - glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix); - glGetDoublev(GL_PROJECTION_MATRIX, projmatrix); - // viewport[3] is height of window in pixels. We need to convert - // from window coordinates, where y increases down, to viewport - // coordinates, where y increases up. - y = viewport[3] - y; - - // Near depth plane intersection. - gluUnProject (x, y, 0.0, mvmatrix, projmatrix, viewport, &wx, &wy, &wz); - SGVec3<double> nnear(wx, wy, wz); - - // Far depth plane intersection. - gluUnProject (x, y, 1.0, mvmatrix, projmatrix, viewport, &wx, &wy, &wz); - SGVec3<double> ffar(wx, wy, wz); - - // If validElevation is not NULL, that means the caller is - // interested in a valid elevation result, which means we must - // query our live scenery. - if (validElevation != NULL) { - // For now, assume that no buckets intersect. - *validElevation = false; - - // Later, we'll ask candidate buckets will redraw themselves - // in select mode to see if there are any intersections. We - // define a new projection matrix containing the pick region, - // which we define to be 1 pixel square. When the buckets - // draw themselves, they will only get results for this small - // region. - glMatrixMode(GL_PROJECTION); - glPushMatrix(); { - glLoadIdentity(); - gluPickMatrix(x, y, 1.0, 1.0, viewport); - glMultMatrixd(projmatrix); - - // Now that we have our viewing ray (although, technically - // speaking, it should actually be a very narrow viewing - // frustum, but a ray is good enough), get the - // intersection. We first ask each visible tile in turn - // if the ray intersects their live scenery, and, if it - // does, the elevation at that point. - const vector<Cullable *>& intersections = _frustum->intersections(); - for (unsigned int i = 0; i < intersections.size(); i++) { - SceneryTile *t = dynamic_cast<SceneryTile *>(intersections[i]); - if (!t) { - continue; - } - if (t->intersection(nnear, ffar, c)) { - // Found one! Since the tile found the - // intersection using one of its buckets (ie, live - // scenery), we know that the elevation value is - // valid. We can also short-circuit our search. - *validElevation = true; - break; - } - } - glMatrixMode(GL_PROJECTION); - } - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - } - // Beyond this point, we don't do any OpenGL stuff, so we can - // restore the old active window. - _aw->set(oldWindow); - - // If the user was interested in getting an elevation and we - // actually got one, we can return now. - if ((validElevation != NULL) && *validElevation) { - return true; - } - - // If we got here, that means no tiles intersected or the user - // isn't interested in an elevation. So, we'll just use a simple - // earth/ray intersection with a standard earth ellipsoid. This - // will give us the lat/lon, but the elevation will always be 0 - // (sea level). - // - // We stretch the universe along the earth's axis so that the - // earth is a sphere. This code assumes that the earth is centred - // at the origin, and that the earth's axis is aligned with the z - // axis, north positive. - // - // This website: - // - // http://mysite.du.edu/~jcalvert/math/ellipse.htm - // - // has a good explanation of ellipses, including the statement "The - // ellipse is just this auxiliary circle with its ordinates shrunk in the - // ratio b/a", where a is the major axis (equatorial plane), and b is - // the minor axis (axis of rotation). - assert((validElevation == NULL) || (*validElevation == false)); - SGVec3<double> centre(0.0, 0.0, 0.0); - double mu1, mu2; - nnear[2] *= SGGeodesy::STRETCH; - ffar[2] *= SGGeodesy::STRETCH; - if (RaySphere(nnear, ffar, centre, SGGeodesy::EQURAD, &mu1, &mu2)) { - SGVec3<double> s1, s2; - s1 = nnear + mu1 * (ffar - nnear); - s2 = nnear + mu2 * (ffar - nnear); + // We assume that when called, the depth test and lighting are + // off. + assert(!glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); - // Take the nearest intersection (the other is on the other - // side of the world). - if (dist(nnear, s1) < dist(nnear, s2)) { - // Unstretch the world. - s1[2] /= SGGeodesy::STRETCH; - *c = s1; - } else { - // Unstretch the world. - s2[2] /= SGGeodesy::STRETCH; - *c = s2; + // Draw elevation figures. + const vector<Cullable *>& intersections = _frustum->intersections(); + for (unsigned int i = 0; i < intersections.size(); i++) { + SceneryTile *t = dynamic_cast<SceneryTile *>(intersections[i]); + if (!t) { + continue; } - - return true; - } else { - return false; + t->label(_metresPerPixel, live); } } Index: Subbucket.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Subbucket.hxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Subbucket.hxx 27 Jul 2014 05:14:58 -0000 1.13 +++ Subbucket.hxx 2 Oct 2014 00:39:17 -0000 1.14 @@ -248,7 +248,6 @@ bool loaded() const { return _loaded; } void unload(); // The (very) approximate size of the subbucket, in bytes. - // unsigned int size(); unsigned int size() const { return _bytes; } double maximumElevation() const { return _maxElevation; } Index: Overlays.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Overlays.cxx,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- Overlays.cxx 4 Feb 2012 05:46:17 -0000 1.50 +++ Overlays.cxx 2 Oct 2014 00:39:17 -0000 1.51 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -99,55 +99,48 @@ // Draws all the overlays. void Overlays::draw(NavData *navData) { - // We assume that when called, the depth test is on, and lighting - // is off. - assert(glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); - - // Overlays must be written on top of whatever scenery is there, - // so we ignore depth values. - glPushAttrib(GL_DEPTH_BUFFER_BIT); { - glDisable(GL_DEPTH_TEST); + // We assume that when called, the depth test and lighting are + // off. + assert(!glIsEnabled(GL_DEPTH_TEST) && !glIsEnabled(GL_LIGHTING)); - if (_overlays[AIRPORTS]) { - _airports->drawBackgrounds(navData); - } - // We sandwich ILSs between runway backgrounds and the runways. - if (_overlays[NAVAIDS] && _overlays[ILS]) { - _navaids->drawILSs(navData); - } - if (_overlays[AIRPORTS]) { - _airports->drawForegrounds(navData); - if (_overlays[LABELS]) { - _airports->drawLabels(navData); - } - } - if (_overlays[AIRWAYS]) { - _airways->draw(_overlays[HIGH], _overlays[LOW], _overlays[LABELS], - navData); - } - if (_overlays[NAVAIDS] && _overlays[FIXES]) { - _fixes->draw(navData); - } - if (_overlays[NAVAIDS] && _overlays[NDB]) { - _navaids->drawNDBs(navData); - } - if (_overlays[NAVAIDS] && _overlays[VOR]) { - _navaids->drawVORs(navData); - } - if (_overlays[NAVAIDS] && _overlays[DME]) { - _navaids->drawDMEs(navData); - } - if (_overlays[CROSSHAIRS]) { - _crosshairs->draw(); - } - if (_overlays[RANGE_RINGS]) { - _rangeRings->draw(); - } - if (_overlays[TRACKS]) { - _tracks->draw(); + if (_overlays[AIRPORTS]) { + _airports->drawBackgrounds(navData); + } + // We sandwich ILSs between runway backgrounds and the runways. + if (_overlays[NAVAIDS] && _overlays[ILS]) { + _navaids->drawILSs(navData); + } + if (_overlays[AIRPORTS]) { + _airports->drawForegrounds(navData); + if (_overlays[LABELS]) { + _airports->drawLabels(navData); } } - glPopAttrib(); + if (_overlays[AIRWAYS]) { + _airways->draw(_overlays[HIGH], _overlays[LOW], _overlays[LABELS], + navData); + } + if (_overlays[NAVAIDS] && _overlays[FIXES]) { + _fixes->draw(navData); + } + if (_overlays[NAVAIDS] && _overlays[NDB]) { + _navaids->drawNDBs(navData); + } + if (_overlays[NAVAIDS] && _overlays[VOR]) { + _navaids->drawVORs(navData); + } + if (_overlays[NAVAIDS] && _overlays[DME]) { + _navaids->drawDMEs(navData); + } + if (_overlays[CROSSHAIRS]) { + _crosshairs->draw(); + } + if (_overlays[RANGE_RINGS]) { + _rangeRings->draw(); + } + if (_overlays[TRACKS]) { + _tracks->draw(); + } } void Overlays::setVisibility(OverlayType type, bool value) |
|
From: Brian S. <bjs...@us...> - 2014-09-18 04:04:33
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5160/src Modified Files: Subbucket.cxx Log Message: Included glew.h so Linux wouldn't complain about undefined OpenGL functions. Index: Subbucket.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Subbucket.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Subbucket.cxx 27 Jul 2014 05:14:58 -0000 1.19 +++ Subbucket.cxx 18 Sep 2014 04:04:31 -0000 1.20 @@ -21,6 +21,13 @@ along with Atlas. If not, see <http://www.gnu.org/licenses/>. ---------------------------------------------------------------------------*/ +// We include glew to get some function definitions that Linux doesn't +// automatically define (eg, glBindBuffer()). Normally, a library +// include file would come after our own include file (Subbucket.hxx). +// However, glew insists on being included before gl.h, and something +// in Subbucket.hxx includes gl.h. +#include <GL/glew.h> + // Our include file #include "Subbucket.hxx" |
|
From: Brian S. <bjs...@us...> - 2014-09-14 05:44:47
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17909/src Modified Files: Geographics.cxx Log Message: Fixed call to nan() (it didn't work on some systems). Index: Geographics.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Geographics.cxx 16 Aug 2014 22:41:18 -0000 1.15 +++ Geographics.cxx 14 Sep 2014 05:44:44 -0000 1.16 @@ -327,8 +327,8 @@ { // Internally, an invalid geodetic coordinate has a NaN latitude, // while an invalide cartesian coordinate has a NaN x value. - _geod.setLatitudeDeg(nan(0)); - _cart.x() = nan(0); + _geod.setLatitudeDeg(nan("")); + _cart.x() = nan(""); } const SGGeod& AtlasCoord::geod() |
|
From: Brian S. <bjs...@us...> - 2014-09-14 05:43:07
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17811/src Modified Files: NavData.cxx NavData.hxx NavaidsOverlay.cxx Log Message: Added LOC_GS type. Index: NavaidsOverlay.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavaidsOverlay.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- NavaidsOverlay.cxx 5 Mar 2014 23:12:23 -0000 1.23 +++ NavaidsOverlay.cxx 14 Sep 2014 05:43:05 -0000 1.24 @@ -1292,6 +1292,7 @@ case ILS_cat_II: case ILS_cat_III: case LDA_GS: + case LOC_GS: if (live) { // // We draw two triangles: one for the front course // // and one for the back course. @@ -1697,6 +1698,9 @@ case LDA_GS: line.appendf(" LDA-GS"); break; + case LOC_GS: + line.appendf(" LOC-GS"); + break; case LDA: line.appendf(" LDA"); break; Index: NavData.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavData.hxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NavData.hxx 19 Aug 2014 03:25:00 -0000 1.4 +++ NavData.hxx 14 Sep 2014 05:43:05 -0000 1.5 @@ -44,8 +44,8 @@ enum NavType {NAV_VOR, NAV_DME, NAV_NDB, NAV_ILS, NAV_GS, NAV_OM, NAV_MM, NAV_IM}; enum NavSubType {DME, DME_ILS, GS, IGS, ILS_cat_I, ILS_cat_II, ILS_cat_III, - IM, LDA, LDA_GS, LOC, LOM, MM, NDB, NDB_DME, OM, SDF, TACAN, - VOR, VOR_DME, VORTAC, UNKNOWN}; + IM, LDA, LDA_GS, LOC, LOC_GS, LOM, MM, NDB, NDB_DME, OM, SDF, + TACAN, VOR, VOR_DME, VORTAC, UNKNOWN}; struct NAV: public Searchable, Cullable { public: Index: NavData.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavData.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NavData.cxx 19 Aug 2014 03:25:00 -0000 1.4 +++ NavData.cxx 14 Sep 2014 05:43:05 -0000 1.5 @@ -720,6 +720,8 @@ navsubtype = ILS_cat_III; } else if (strcmp(subType, "LDA-GS") == 0) { navsubtype = LDA_GS; + } else if (strcmp(subType, "LOC-GS") == 0) { + navsubtype = LOC_GS; } else { navsubtype = UNKNOWN; } |
|
From: Brian S. <bjs...@us...> - 2014-08-19 03:36:53
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22202/src Modified Files: Searcher.hxx Log Message: Part of update to read v1000 airport files. Index: Searcher.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Searcher.hxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Searcher.hxx 4 Feb 2012 05:46:17 -0000 1.7 +++ Searcher.hxx 19 Aug 2014 03:36:51 -0000 1.8 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack A Searchable is anything that can be added to and used by a Searcher. It is capable of representing itself as a @@ -58,9 +58,13 @@ std::vector<std::string>& tokens); // All of our tokens. + // EYE - we make a copy of these, which is a waste. We should + // really manage pointers to strings, rather than strings. virtual const std::vector<std::string>& tokens() = 0; - // A nicely printed representation of ourselves. - virtual const std::string& asString() = 0; + // A nicely printed representation of ourselves. Callers should + // copy this if they need a permanent copy, as subclasses aren't + // required to maintain a local copy. + virtual const char *asString() = 0; // Cartesian coordinate (sgdVec3). virtual const double *location() const = 0; @@ -73,7 +77,7 @@ // a caseless comparison. class CaseFreeLessThan { public: - bool operator()(const std::string& left, const std::string& right) { + bool operator()(const std::string& left, const std::string& right) const { return (strcasecmp(left.c_str(), right.c_str()) < 0); } }; |
|
From: Brian S. <bjs...@us...> - 2014-08-19 03:25:02
|
Update of /cvsroot/atlas/Atlas In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21460 Modified Files: NEWS configure.ac Log Message: Updated to read v1000 airport files. In the process, I changed ARP and RWY to classes rather than simple structs. Index: NEWS =================================================================== RCS file: /cvsroot/atlas/Atlas/NEWS,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- NEWS 12 Jun 2009 09:32:37 -0000 1.6 +++ NEWS 19 Aug 2014 03:25:00 -0000 1.7 @@ -1,3 +1,32 @@ +New in 0.5.0 +== Atlas == +* Atlas can read v1000 airport files +* Preferences have changed slightly; serial connections are specified + by a single <device, baud rate> pair, rather than by two separate + command-line options, which means the --baud option is gone. +* Maps can now be rendered from Atlas. Atlas shows the status of + scenery (downloaded or not) and maps (rendered or not). +* Anti-aliasing is now always enabled, both for live scenery and for + map generationg (via OpenGL multisampling). The --aafactor option + has been removed. +* Lighting can be set for live scenery, and these settings are used + when rendering maps in Atlas. New 'lighting' options include + contour lines. +* Distances and headings can be measured with a ruler function. This + feature can also be used to create crude routes. +* Instead of an airplane stick figure, an image can be used instead + (and is now the default). +* The background image (generally a picture of the globe) can be + turned off. This is nice for those who have a complete set of + FlightGear scenery. +* The code has undergone significant rewriting, the hope being that it + will be easier to maintain and expand. + +== Map == +* Map uses OpenGL framebuffer objects (FBOs) to do its rendering (as + does Atlas, which uses the same code). As a consequence, maps are + not constrained by window sizes. + New in 0.4.0 == Atlas == * The world is now rendered as a sphere, rather than a flat map. Index: configure.ac =================================================================== RCS file: /cvsroot/atlas/Atlas/configure.ac,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- configure.ac 28 Jan 2012 04:59:19 -0000 1.29 +++ configure.ac 19 Aug 2014 03:25:00 -0000 1.30 @@ -3,7 +3,7 @@ dnl dnl $Id$ -AC_INIT([Atlas], [0.4.9]) +AC_INIT([Atlas], [0.5.0]) AC_CONFIG_SRCDIR([src/Atlas.cxx]) dnl Initialize the automake stuff @@ -314,7 +314,7 @@ AC_LANG_PUSH(C++) dnl Check for "plib" without which we cannot go on -AC_CHECK_HEADER(plib/pu.h) +AC_CHECK_HEADERS(plib/pu.h) if test "x$ac_cv_header_plib_pu_h" != "xyes"; then echo echo "You *must* have the plib library installed on your system to build" |
|
From: Brian S. <bjs...@us...> - 2014-08-17 20:20:21
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5523/src Modified Files: misc.cxx Log Message: Removed out-of-date comment, updated copyright. Index: misc.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/misc.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- misc.cxx 5 Sep 2012 03:37:18 -0000 1.23 +++ misc.cxx 17 Aug 2014 20:20:19 -0000 1.24 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -265,7 +265,6 @@ unsigned int toRead = length; // First read as much of the line as we can. - // EYE - check return code, use gzerror() to report error. if (gzgets(f, readPoint, toRead) == Z_NULL) { int errnum; fprintf(stderr, "gzGetLine error: %s\n", gzerror(f, &errnum)); |
|
From: Brian S. <bjs...@us...> - 2014-08-17 20:18:35
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5385/src Modified Files: GLUTWindow.cxx Log Message: Added stdlib.h include (I think it's needed on newer versions of OS X), and updated the copyright notice. Index: GLUTWindow.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/GLUTWindow.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- GLUTWindow.cxx 5 Sep 2012 03:32:24 -0000 1.5 +++ GLUTWindow.cxx 17 Aug 2014 20:18:32 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This file is part of Atlas. @@ -24,6 +24,9 @@ // Our include file #include "GLUTWindow.hxx" +// C system files +#include <stdlib.h> + // C++ system files #include <assert.h> |
|
From: Brian S. <bjs...@us...> - 2014-08-17 20:16:12
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5250/src Modified Files: CrosshairsOverlay.cxx Log Message: Changed include statement and copyright notice. Index: CrosshairsOverlay.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/CrosshairsOverlay.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- CrosshairsOverlay.cxx 4 Feb 2012 05:46:16 -0000 1.9 +++ CrosshairsOverlay.cxx 17 Aug 2014 20:16:09 -0000 1.10 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -26,7 +26,7 @@ // Other libraries' include files #if defined( __APPLE__) -# include <GL/glu.h> // Needed for gluOrtho2D(), ... +# include <OpenGL/glu.h> // Needed for gluOrtho2D(), ... #else # ifdef WIN32 # include <windows.h> |
|
From: Brian S. <bjs...@us...> - 2014-08-16 22:41:21
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20812/src Modified Files: Geographics.cxx Geographics.hxx Log Message: Changed some doubles to floats - we didn't need the precision. Index: Geographics.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.hxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Geographics.hxx 2 May 2014 03:49:46 -0000 1.8 +++ Geographics.hxx 16 Aug 2014 22:41:18 -0000 1.9 @@ -66,13 +66,13 @@ // belong here. enum GeodTextFiddling {NO_FIDDLING, FIDDLE_TEXT, FIDDLE_ALL}; void geodDrawText(LayoutManager& lm, - const sgdVec3 cart, double lat, double lon, double hdg = 0.0, + const sgdVec3 cart, float lat, float lon, float hdg = 0.0, GeodTextFiddling fiddling = FIDDLE_TEXT); void geodDrawText(LayoutManager& lm, - double lat, double lon, double hdg = 0.0, + double lat, double lon, float hdg = 0.0, GeodTextFiddling fiddling = FIDDLE_TEXT); void geodDrawText(LayoutManager& lm, - const sgdVec3 cart, double hdg = 0.0, + const sgdVec3 cart, float hdg = 0.0, GeodTextFiddling fiddling = FIDDLE_TEXT); // Draws a vertex at the given lat/lon, given in degrees. Also @@ -96,11 +96,11 @@ // do no checking to ensure this (although you should get OpenGL // errors, because they translate into glPushMatrix() and // glPopMatrix() calls). -void geodPushMatrix(const sgdVec3 cart, double lat, double lon, - double hdg = 0.0); -void geodPushMatrix(double lat, double lon, double hdg = 0.0, - double elev = 0.0); -void geodPushMatrix(const sgdVec3 cart, double hdg = 0.0); +void geodPushMatrix(const sgdVec3 cart, float lat, float lon, + float hdg = 0.0); +void geodPushMatrix(double lat, double lon, float hdg = 0.0, + float elev = 0.0); +void geodPushMatrix(const sgdVec3 cart, float hdg = 0.0); void geodPopMatrix(); // This class represents a great circle route between two points. In Index: Geographics.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Geographics.cxx 19 May 2014 23:00:58 -0000 1.14 +++ Geographics.cxx 16 Aug 2014 22:41:18 -0000 1.15 @@ -32,8 +32,8 @@ // Draw text at the given latitude and longitude, with hdg pointing // up. -void geodDrawText(LayoutManager& lm, const sgdVec3 cart, double lat, - double lon, double hdg, GeodTextFiddling fiddling) +void geodDrawText(LayoutManager& lm, const sgdVec3 cart, float lat, + float lon, float hdg, GeodTextFiddling fiddling) { LayoutManager::Point anchor = lm.anchor(); @@ -94,7 +94,7 @@ lm.setAnchor(anchor); } -void geodDrawText(LayoutManager& lm, double lat, double lon, double hdg, +void geodDrawText(LayoutManager& lm, double lat, double lon, float hdg, GeodTextFiddling fiddling) { sgdVec3 cart; @@ -105,7 +105,7 @@ geodDrawText(lm, cart, lat, lon, hdg, fiddling); } -void geodDrawText(LayoutManager& lm, const sgdVec3 cart, double hdg, +void geodDrawText(LayoutManager& lm, const sgdVec3 cart, float hdg, GeodTextFiddling fiddling) { double lat, lon, alt; @@ -129,7 +129,7 @@ glVertex3f(cart[0], cart[1], cart[2]); } -void geodPushMatrix(const sgdVec3 cart, double lat, double lon, double hdg) +void geodPushMatrix(const sgdVec3 cart, float lat, float lon, float hdg) { glPushMatrix(); glTranslated(cart[0], cart[1], cart[2]); @@ -138,7 +138,7 @@ glRotatef(-hdg, 0.0, 0.0, 1.0); } -void geodPushMatrix(double lat, double lon, double hdg, double elev) +void geodPushMatrix(double lat, double lon, float hdg, float elev) { sgdVec3 cart; sgGeodToCart(lat * SGD_DEGREES_TO_RADIANS, @@ -148,7 +148,7 @@ geodPushMatrix(cart, lat, lon, hdg); } -void geodPushMatrix(const sgdVec3 cart, double hdg) +void geodPushMatrix(const sgdVec3 cart, float hdg) { double lat, lon, alt; sgCartToGeod(cart, &lat, &lon, &alt); |
|
From: Brian S. <bjs...@us...> - 2014-05-19 23:06:43
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20195/src Modified Files: Bucket.cxx Log Message: Comment change. Index: Bucket.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Bucket.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Bucket.cxx 1 Aug 2012 21:55:56 -0000 1.15 +++ Bucket.cxx 19 May 2014 23:06:40 -0000 1.16 @@ -44,7 +44,10 @@ // EYE - should we make this nan()/nanl()/nanf() and have an isNanE() // function (which is just isnan())? Note that we can't do simple -// comparisons with NaNs - the results are always false. +// comparisons with NaNs - the results are always false. Note as well +// that instead of the C++ constants, we can use C constants (FLT_MAX, +// DBL_MAX, .... See 'man float' for a list. See as well 'man 3 +// math' for a bunch of useful functions and constants). const float Bucket::NanE = -numeric_limits<float>::max(); // EYE - chunk? tile? bucket? In newbucket.hxx, it seems that a 1x1 |
|
From: Brian S. <bjs...@us...> - 2014-05-19 23:01:01
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19765/src Modified Files: Geographics.cxx Log Message: Removed redundant invalidate() calls. Index: Geographics.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Geographics.cxx 2 May 2014 03:49:46 -0000 1.13 +++ Geographics.cxx 19 May 2014 23:00:58 -0000 1.14 @@ -300,25 +300,21 @@ AtlasCoord::AtlasCoord(double lat, double lon, double elev) { - invalidate(); set(lat, lon, elev); } AtlasCoord::AtlasCoord(SGGeod& geod) { - invalidate(); set(geod); } AtlasCoord::AtlasCoord(SGVec3<double>& cart) { - invalidate(); set(cart); } AtlasCoord::AtlasCoord(sgdVec3 cart) { - invalidate(); set(cart); } |
|
From: Brian S. <bjs...@us...> - 2014-05-02 03:49:48
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3204/src Modified Files: Geographics.cxx Geographics.hxx Log Message: Replaced two bools (_geodValid and _cartValid) with two methods that just set _geod and _cart to invalid states, thus saving a grand total of 16 bytes in each AtlasCoord. Index: Geographics.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.hxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Geographics.hxx 4 Feb 2012 05:46:17 -0000 1.7 +++ Geographics.hxx 2 May 2014 03:49:46 -0000 1.8 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack Some useful routines for scribbling on the earth. @@ -225,11 +225,14 @@ void _cartToGeod(); void _geodToCart(); + // These return true if the geodetic or the cartesian coordinates + // are valid, respectively. + bool _geodValid() const; + bool _cartValid() const; + // Our data. SGGeod _geod; - bool _geodValid; SGVec3<double> _cart; - bool _cartValid; }; #endif Index: Geographics.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Geographics.cxx 5 Mar 2014 23:55:29 -0000 1.12 +++ Geographics.cxx 2 May 2014 03:49:46 -0000 1.13 @@ -293,39 +293,46 @@ // AtlasCoord ////////////////////////////////////////////////////////////////////// -AtlasCoord::AtlasCoord(): _geodValid(false), _cartValid(false) +AtlasCoord::AtlasCoord() { + invalidate(); } -AtlasCoord::AtlasCoord(double lat, double lon, double elev): - _cartValid(false) +AtlasCoord::AtlasCoord(double lat, double lon, double elev) { + invalidate(); set(lat, lon, elev); } -AtlasCoord::AtlasCoord(SGGeod& geod): _cartValid(false) +AtlasCoord::AtlasCoord(SGGeod& geod) { + invalidate(); set(geod); } -AtlasCoord::AtlasCoord(SGVec3<double>& cart): _geodValid(false) +AtlasCoord::AtlasCoord(SGVec3<double>& cart) { + invalidate(); set(cart); } -AtlasCoord::AtlasCoord(sgdVec3 cart): _geodValid(false) +AtlasCoord::AtlasCoord(sgdVec3 cart) { + invalidate(); set(cart); } bool AtlasCoord::valid() const { - return (_geodValid || _cartValid); + return (_geodValid() || _cartValid()); } void AtlasCoord::invalidate() { - _geodValid = _cartValid = false; + // Internally, an invalid geodetic coordinate has a NaN latitude, + // while an invalide cartesian coordinate has a NaN x value. + _geod.setLatitudeDeg(nan(0)); + _cart.x() = nan(0); } const SGGeod& AtlasCoord::geod() @@ -333,7 +340,7 @@ if (!valid()) { throw std::runtime_error("invalid AtlasCoord"); } - if (!_geodValid) { + if (!_geodValid()) { _cartToGeod(); } return _geod; @@ -359,7 +366,7 @@ if (!valid()) { throw std::runtime_error("invalid AtlasCoord"); } - if (!_cartValid) { + if (!_cartValid()) { _geodToCart(); } return _cart; @@ -387,47 +394,52 @@ void AtlasCoord::set(double lat, double lon, double elev) { + invalidate(); _geod.setLatitudeDeg(lat); _geod.setLongitudeDeg(lon); _geod.setElevationM(elev); - _geodValid = true; - _cartValid = false; } void AtlasCoord::set(const SGGeod& geod) { + invalidate(); _geod = geod; - _geodValid = true; - _cartValid = false; } void AtlasCoord::set(const SGVec3<double>& cart) { + invalidate(); _cart = cart; - _cartValid = true; - _geodValid = false; } void AtlasCoord::set(const sgdVec3 cart) { + invalidate(); _cart[0] = cart[0]; _cart[1] = cart[1]; _cart[2] = cart[2]; - _cartValid = true; - _geodValid = false; } void AtlasCoord::_cartToGeod() { - assert(_cartValid && !_geodValid); + assert(_cartValid() && !_geodValid()); SGGeodesy::SGCartToGeod(_cart, _geod); - _geodValid = true; } void AtlasCoord::_geodToCart() { - assert(_geodValid && !_cartValid); + assert(_geodValid() && !_cartValid()); SGGeodesy::SGGeodToCart(_geod, _cart); - _cartValid = true; } +bool AtlasCoord::_geodValid() const +{ + // Note: this has to agree with the value set in invalidate()! + return !isnan(_geod.getLatitudeDeg()); +} + +bool AtlasCoord::_cartValid() const +{ + // Note: this has to agree with the value set in invalidate()! + return !isnan(_cart.x()); +} |
|
From: Brian S. <bjs...@us...> - 2014-03-08 22:00:00
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5288/src Modified Files: Searcher.cxx Log Message: Fixed bug in tokenizing (actually, it used to work - is this new iostream behaviour?). Index: Searcher.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Searcher.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Searcher.cxx 4 Feb 2012 05:46:17 -0000 1.6 +++ Searcher.cxx 8 Mar 2014 21:59:57 -0000 1.7 @@ -151,18 +151,16 @@ _isPartial = false; istringstream stream(str); - stream >> _aToken; - while (stream) { + while (!stream.eof()) { + stream >> _aToken; // To determine if the current token is complete or not, we // just see if we've gone to the end of the stream. If we're // at the very end, then the current token is incomplete. - unsigned int loc = stream.tellg(); - if (loc == str.length()) { + if (stream.eof()) { _partialSearchToken = _aToken; } else { _completeSearchTokens.push_back(_aToken); } - stream >> _aToken; } // Now grab a search token. It doesn't really matter which |
|
From: Brian S. <bjs...@us...> - 2014-03-06 00:00:19
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12784/src Modified Files: AtlasWindow.cxx AtlasWindow.hxx Log Message: Changed annoying Bounds() method to bounds() (which meant changing the member name to _bounds). Improved the way _addString() and _createStrings() work. Index: AtlasWindow.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AtlasWindow.hxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AtlasWindow.hxx 14 Oct 2012 19:50:47 -0000 1.5 +++ AtlasWindow.hxx 6 Mar 2014 00:00:17 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This is the main Atlas window. It can draw itself and react to user input. It handles the main window UI, and subsidiary UI's on the @@ -797,8 +797,8 @@ protected: int _createStrings(AtlasWindow *aw); - int _addString(const char *str, AtlasWindow::RenderType t, bool force, - int i); + void _addString(const char *str, AtlasWindow::RenderType t, bool force, + int i); puOneShot *_makeButton(const char *label, int val, puCallback cb, void *data); Index: AtlasWindow.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AtlasWindow.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- AtlasWindow.cxx 14 Oct 2012 19:50:47 -0000 1.9 +++ AtlasWindow.cxx 6 Mar 2014 00:00:17 -0000 1.10 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This file is part of Atlas. @@ -1618,7 +1618,7 @@ // square of the distance. But 'we' may be wrong. To prevent // divide-by-zero errors, we arbitrarily set 1 metre as the // minimum distance. - double d = SG_MAX2(sgdDistanceVec3(p->cart, n->bounds.center), 1.0); + double d = SG_MAX2(sgdDistanceVec3(p->cart, n->bounds().center), 1.0); double s = (double)n->range / d; s *= s; @@ -1752,7 +1752,8 @@ // To prevent divide-by-zero errors, we arbitrarily // set 1 metre as the minimum distance. double d = - SG_MAX2(sgdDistanceSquaredVec3(p->cart, n->bounds.center), + SG_MAX2(sgdDistanceSquaredVec3(p->cart, + n->bounds().center), 1.0); double s = (double)n->range * (double)n->range / d; if ((chosen == NULL) || (s < weakest)) { @@ -1790,7 +1791,8 @@ } } else if (n->navtype == NAV_DME) { dme = n; - d = sgdDistanceVec3(p->cart, dme->bounds.center) - dme->magvar; + d = sgdDistanceVec3(p->cart, + dme->bounds().center) - dme->magvar; } } str.appendf(" (%s", id->c_str()); @@ -1850,7 +1852,7 @@ // square of the distance. But 'we' may be wrong. To prevent // divide-by-zero errors, we arbitrarily set 1 metre as the // minimum distance. - double d = SG_MAX2(sgdDistanceSquaredVec3(p->cart, n->bounds.center), + double d = SG_MAX2(sgdDistanceSquaredVec3(p->cart, n->bounds().center), 1.0); double s = (double)n->range * (double)n->range / d; @@ -2858,90 +2860,112 @@ int RenderDialog::_createStrings(AtlasWindow *aw) { int i = 0; + _strings[0] = NULL; - // Figure out our "global" menu entries - these are ones - // that don't depend on what's under the mouse. - - // EYE - we should probably choose by default the most reasonable - // option: (1) When there are unrendered maps, choose "render all - // unrendered maps", (2) When there are no unrendered maps, choose - // "render all tile/chunk maps", depending on which one is the - // smallest. + // Figure out our "global" menu entries - these are ones that + // don't depend on what's under the mouse. TileManager *tm = aw->ac()->tileManager(); - int count = tm->tileCount(TileManager::DOWNLOADED); - if (count > 0) { - _rerenderAllStr.printf("Rerender all maps (%d)", count); - i = _addString(_rerenderAllStr.str(), AtlasWindow::RENDER_ALL, true, i); - } - count = tm->tileCount(TileManager::UNMAPPED); - if (count > 0) { - _renderAllStr.printf("Render all unrendered maps (%d)", count); - i = _addString(_renderAllStr.str(), AtlasWindow::RENDER_ALL, false, i); + int downloaded = tm->tileCount(TileManager::DOWNLOADED); + int unmapped = tm->tileCount(TileManager::UNMAPPED); + if (downloaded > 0) { + if (unmapped == downloaded) { + // All downloaded maps are unmapped, so just offer to map + // everything. + _renderAllStr.printf("Render all maps (%d)", unmapped); + _addString(_renderAllStr.str(), AtlasWindow::RENDER_ALL, false, + i++); + } else { + if (unmapped > 0) { + _renderAllStr.printf("Render all unrendered maps (%d)", + unmapped); + _addString(_renderAllStr.str(), AtlasWindow::RENDER_ALL, false, + i++); + } + _rerenderAllStr.printf("Rerender all maps (%d)", downloaded); + _addString(_rerenderAllStr.str(), AtlasWindow::RENDER_ALL, true, + i++); + } } - // If the current location isn't on the earth, return. + // If the current location isn't on the earth, we don't need to + // bother with chunks and tiles. if (!_currentLoc.coord().valid()) { - _strings[i] = NULL; return i; } // If the current location is an empty scenery chunk, return. GeoLocation loc(_currentLoc.lat(), _currentLoc.lon(), true); if (tm->chunk(loc) == NULL) { - _strings[i] = NULL; return i; } // Now add the chunk-level entries to the menu. Chunk *c = tm->chunk(loc); if (!c) { - _strings[i] = NULL; return i; } - count = c->tileCount(TileManager::DOWNLOADED); - if (count > 0) { - _rerender10Str.printf("Rerender %s chunk maps (%d)", - c->name(), count); - i = _addString(_rerender10Str.str(), AtlasWindow::RENDER_10, true, i); - } - count = c->tileCount(TileManager::UNMAPPED); - if (count > 0) { - _render10Str.printf("Render all unrendered %s chunk maps (%d)", - c->name(), count); - i = _addString(_render10Str.str(), AtlasWindow::RENDER_10, false, i); + downloaded = c->tileCount(TileManager::DOWNLOADED); + unmapped = c->tileCount(TileManager::UNMAPPED); + if (downloaded > 0) { + if (unmapped == downloaded) { + _render10Str.printf("Render all %s chunk maps (%d)", + c->name(), unmapped); + _addString(_render10Str.str(), AtlasWindow::RENDER_10, false, i++); + } else { + if (unmapped > 0) { + _render10Str.printf("Render all unrendered %s chunk maps (%d)", + c->name(), unmapped); + _addString(_render10Str.str(), AtlasWindow::RENDER_10, false, + i++); + } + _rerender10Str.printf("Rerender %s chunk maps (%d)", + c->name(), downloaded); + _addString(_rerender10Str.str(), AtlasWindow::RENDER_10, true, i++); + } } - // Now look at tile information. + // Now look at tile information. Like chunks, return immediately + // if there's no tile at the current location, or if the tile has + // no scenery. Tile *t = c->tile(loc); if (!t || !t->hasScenery()) { - _strings[i] = NULL; return i; } - if (t->maps().any()) { - _rerender1Str.printf("Rerender %s tile maps", Tile::name(loc)); - i = _addString(_rerender1Str.str(), AtlasWindow::RENDER_1, true, i); - } - if (t->missingMaps().any()) { - _render1Str.printf("Render all unrendered %s tile maps", t->name()); - i = _addString(_render1Str.str(), AtlasWindow::RENDER_1, false, i); + // Okay, the number of map levels isn't really a count of + // downloaded maps, but I just want to be consistent. + downloaded = t->mapLevels().count(); + unmapped = t->missingMaps().count(); + if (downloaded > 0) { + if (unmapped == downloaded) { + _render1Str.printf("Render all %s tile maps", t->name()); + _addString(_render1Str.str(), AtlasWindow::RENDER_1, false, i++); + } else { + if (unmapped > 0) { + _render1Str.printf("Render all unrendered %s tile maps", + t->name()); + _addString(_render1Str.str(), AtlasWindow::RENDER_1, false, + i++); + } + _rerender1Str.printf("Rerender %s tile maps", Tile::name(loc)); + _addString(_rerender1Str.str(), AtlasWindow::RENDER_1, true, i++); + } } - _strings[i] = NULL; return i; } // EYE - this all seems very ugly; there must be a cleaner way to do // this -int RenderDialog::_addString(const char *str, AtlasWindow::RenderType t, - bool force, int i) +void RenderDialog::_addString(const char *str, AtlasWindow::RenderType t, + bool force, int i) { _strings[i] = str; _types[i] = t; _forces[i] = force; - return i + 1; + _strings[i + 1] = NULL; } puOneShot *RenderDialog::_makeButton(const char *label, int val, @@ -2990,7 +3014,8 @@ void Route::deleteLastPoint() { // You'd think pop_back() would be smart enough to check for an - // empty vector, but it's not. + // empty vector, but it's not. You have to wonder about STL + // sometimes. if (!_points.empty()) { _points.pop_back(); } |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:55:31
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12454/src Modified Files: Geographics.cxx Log Message: Fixed typo. Index: Geographics.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Geographics.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Geographics.cxx 1 Aug 2012 21:55:08 -0000 1.11 +++ Geographics.cxx 5 Mar 2014 23:55:29 -0000 1.12 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -187,8 +187,8 @@ // // Depending on the zoom, that may result in very short segments // (when zoomed out far), or very long segments (when zoomed in - // close). We don't let segments shrink to less than - // pixeslPerSegment. + // close). We don't let segments shrink to fewer pixels than + // minPixelsPerSegment. const float degreesPerSegment = 1 / 60.0; const int minPixelsPerSegment = 10; const float metresPerDegree = 1e7 / 90.0; |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:54:59
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12399/src Modified Files: Scenery.cxx Log Message: Fixed bug in creating default red and white checkerboard image. Index: Scenery.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Scenery.cxx,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Scenery.cxx 5 Mar 2014 23:42:47 -0000 1.38 +++ Scenery.cxx 5 Mar 2014 23:54:57 -0000 1.39 @@ -282,7 +282,7 @@ // Nope. Create it. for (int i = 0; i < __defaultSize; i ++) { for (int j = 0; j < __defaultSize; j++) { - bool c = ((((i & 0x1) == 0) ^ ((j & 0x1)) == 0)); + bool c = (((i & 0x1) == 0) ^ ((j & 0x1) == 0)); if (c) { // Red square __defaultImage[i][j][0] = 255; |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:51:09
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12182/src Modified Files: Tiles.cxx Log Message: Removed unneeded comparison of non-negativity of an unsigned int. Index: Tiles.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Tiles.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Tiles.cxx 24 Aug 2012 23:12:00 -0000 1.22 +++ Tiles.cxx 5 Mar 2014 23:51:07 -0000 1.23 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -337,7 +337,7 @@ unsigned int level; if (entity->d_isdir && sscanf(entity->d_name, "%u", &level) == 1) { - if ((level >= 0) && (level < MAX_MAP_LEVEL)) { + if (level < MAX_MAP_LEVEL) { _mapLevels[level] = true; } } |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:46:16
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11825/src Modified Files: NavData.cxx NavData.hxx Log Message: Changed annoying Bounds() method to bounds() (which meant changing the member name to _bounds). Index: NavData.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavData.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NavData.cxx 4 Feb 2012 05:46:17 -0000 1.2 +++ NavData.cxx 5 Mar 2014 23:46:14 -0000 1.3 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This file is part of Atlas. @@ -42,7 +42,7 @@ ////////////////////////////////////////////////////////////////////// double NAV::distanceSquared(const sgdVec3 from) const { - return sgdDistanceSquaredVec3(bounds.center, from); + return sgdDistanceSquaredVec3(_bounds.center, from); } // Returns our tokens, generating them if they haven't been already. @@ -153,7 +153,7 @@ double FIX::distanceSquared(const sgdVec3 from) const { - return sgdDistanceSquaredVec3(bounds.center, from); + return sgdDistanceSquaredVec3(_bounds.center, from); } // Returns our tokens, generating them if they haven't been already. @@ -184,7 +184,7 @@ double ARP::distanceSquared(const sgdVec3 from) const { - return sgdDistanceSquaredVec3(bounds.center, from); + return sgdDistanceSquaredVec3(_bounds.center, from); } // Returns our tokens, generating them if they haven't been already. @@ -692,8 +692,8 @@ sgdVec3 center; atlasGeodToCart(lat, lon, elev * SG_FEET_TO_METER, center); - n->bounds.setCenter(center); - n->bounds.setRadius(n->range); + n->_bounds.setCenter(center); + n->_bounds.setRadius(n->range); // Add to our culler. _frustumCullers[NAVAIDS]->culler().addObject(n); @@ -780,8 +780,8 @@ atlasGeodToCart(f->lat, f->lon, 0.0, point); // We arbitrarily say fixes have a radius of 1000m. - f->bounds.radius = 1000.0; - f->bounds.setCenter(point); + f->_bounds.radius = 1000.0; + f->_bounds.setCenter(point); // Until determined otherwise, fixes are not assumed to be // part of any low or high altitude airways. @@ -881,9 +881,9 @@ // EYE - save these two points sgdVec3 point; atlasGeodToCart(a->start.lat, a->start.lon, 0.0, point); - a->bounds.extend(point); + a->_bounds.extend(point); atlasGeodToCart(a->end.lat, a->end.lon, 0.0, point); - a->bounds.extend(point); + a->_bounds.extend(point); double az1, az2, s; geo_inverse_wgs_84(0.0, a->start.lat, a->start.lon, a->end.lat, a->end.lon, @@ -1033,9 +1033,9 @@ double lat, lon, alt; sgdVec3 c; sgdSetVec3(c, - ap->bounds.center[0], - ap->bounds.center[1], - ap->bounds.center[2]); + ap->_bounds.center[0], + ap->_bounds.center[1], + ap->_bounds.center[2]); sgCartToGeod(c, &lat, &lon, &alt); ap->lat = lat * SGD_RADIANS_TO_DEGREES; ap->lon = lon * SGD_RADIANS_TO_DEGREES; @@ -1099,10 +1099,10 @@ // Calculate our bounding sphere. sgdVec3 center; atlasGeodToCart(rwy->lat, rwy->lon, elev, center); - sgdCopyVec3(rwy->bounds.center, center); + sgdCopyVec3(rwy->_bounds.center, center); sgdMat4 mat; - sgdMakeTransMat4(mat, rwy->bounds.center); + sgdMakeTransMat4(mat, rwy->_bounds.center); sgdPreMultMat4(mat, rot); sgdVec3 ll = {rwy->width / 2, 0.0, -rwy->length / 2}; @@ -1114,10 +1114,10 @@ sgdXformPnt3(lr, mat); sgdXformPnt3(ll, mat); sgdXformPnt3(ur, mat); - rwy->bounds.extend(ul); - rwy->bounds.extend(ll); - rwy->bounds.extend(ll); - rwy->bounds.extend(ur); + rwy->_bounds.extend(ul); + rwy->_bounds.extend(ll); + rwy->_bounds.extend(ll); + rwy->_bounds.extend(ur); } void NavData::_loadAirports810(const gzFile& arp) @@ -1243,7 +1243,7 @@ ap->rwys.push_back(rwy); __runwayExtents(rwy, ap->elev); - ap->bounds.extend(&(rwy->bounds)); + ap->_bounds.extend(&(rwy->_bounds)); // According to the FAA's "VFR Aeronautical Chart // Symbols", lighting codes on VFR maps refer to Index: NavData.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavData.hxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NavData.hxx 4 Feb 2012 05:46:17 -0000 1.2 +++ NavData.hxx 5 Mar 2014 23:46:14 -0000 1.3 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2014 Brian Schack This contains all the classes used to read in and access our navaid and airport data. The various classes are gathered together in the @@ -50,13 +50,13 @@ struct NAV: public Searchable, Cullable { public: // Searchable interface. - const double *location() const { return bounds.center; } + const double *location() const { return _bounds.center; } virtual double distanceSquared(const sgdVec3 from) const; virtual const std::vector<std::string>& tokens(); virtual const std::string& asString(); // Cullable interface. - const atlasSphere& Bounds() { return bounds; } + const atlasSphere& bounds() { return _bounds; } double latitude() { return lat; } double longitude() { return lon; } @@ -77,7 +77,7 @@ // GS - ssshhh.hhh - slope * 100,000 and true heading (degrees) // DME - bias (metres) float magvar; - atlasSphere bounds; + atlasSphere _bounds; protected: std::vector<std::string> _tokens; @@ -87,20 +87,20 @@ struct FIX: public Searchable, Cullable { public: // Searchable interface. - const double *location() const { return bounds.center; } + const double *location() const { return _bounds.center; } virtual double distanceSquared(const sgdVec3 from) const; virtual const std::vector<std::string>& tokens(); virtual const std::string& asString(); // Cullable interface. - const atlasSphere& Bounds() { return bounds; } + const atlasSphere& bounds() { return _bounds; } double latitude() { return lat; } double longitude() { return lon; } char name[6]; // Fixes are always 5 characters or less. double lat, lon; bool low, high; - atlasSphere bounds; + atlasSphere _bounds; protected: std::vector<std::string> _tokens; @@ -120,7 +120,7 @@ // AWY - a single airway segment, perhaps shared by several airways. struct AWY: public Cullable { // Cullable interface. - const atlasSphere& Bounds() { return bounds; } + const atlasSphere& bounds() { return _bounds; } // EYE - an approximation - use centre? double latitude() { return start.lat; } double longitude() { return start.lon; } @@ -129,7 +129,7 @@ struct AwyLabel start, end; bool isLow; // True if a low airway, false if high int base, top; // Base and top of airway in 100's of feet - atlasSphere bounds; + atlasSphere _bounds; double length; // Length of segment in metres }; @@ -139,7 +139,7 @@ float hdg; // true heading, in degrees float length, width; // metres - atlasSphere bounds; + atlasSphere _bounds; sgdVec3 ahead, aside, above; }; @@ -152,14 +152,13 @@ struct ARP: public Searchable, Cullable { public: // Searchable interface. - const double *location() const { return bounds.center; } + const double *location() const { return _bounds.center; } virtual double distanceSquared(const sgdVec3 from) const; virtual const std::vector<std::string>& tokens(); virtual const std::string& asString(); // Cullable interface. - // EYE - change Bounds() to something better - const atlasSphere& Bounds() { return bounds; } + const atlasSphere& bounds() { return _bounds; } double latitude() { return lat; } double longitude() { return lon; } @@ -175,7 +174,7 @@ std::vector<RWY *> rwys; std::map<ATCCodeType, FrequencyMap> freqs; - atlasSphere bounds; + atlasSphere _bounds; protected: std::vector<std::string> _tokens; |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:42:50
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11516/src Modified Files: Scenery.cxx Log Message: Changed annoying Bounds() method to bounds(); fixed a few typos; fixed bug restoring old window in intersection(). Index: Scenery.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Scenery.cxx,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Scenery.cxx 24 Aug 2012 23:22:55 -0000 1.37 +++ Scenery.cxx 5 Mar 2014 23:42:47 -0000 1.38 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2008 - 2012 Brian Schack + Copyright (C) 2008 - 2014 Brian Schack This file is part of Atlas. @@ -114,7 +114,7 @@ // Cullable interface. void setBounds(atlasSphere& bounds) { _bounds = bounds; } - const atlasSphere& Bounds() { return _bounds; } + const atlasSphere& bounds() { return _bounds; } double latitude() { return _ti->centreLat(); } double longitude() { return _ti->centreLon(); } @@ -344,7 +344,7 @@ glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - // A few note on textures for my benefit: + // A few notes on textures for my benefit: // // Textures have state. Texture state for the *current* // texture is set by glTexParameter(). Texture units also @@ -1092,6 +1092,9 @@ GLdouble mvmatrix[16], projmatrix[16]; GLdouble wx, wy, wz; // World x, y, z coords. + // Make sure we're the active window. + int oldWindow = _aw->set(); + // Our line is given by two points: the intersection of our // viewing "ray" with the near depth plane and far depth planes. // This assumes that we're using an orthogonal projection - in a @@ -1157,14 +1160,19 @@ } glPopMatrix(); glMatrixMode(GL_MODELVIEW); + } + // Beyond this point, we don't do any OpenGL stuff, so we can + // restore the old active window. + _aw->set(oldWindow); - if (*validElevation) { - return true; - } + // If the user was interested in getting an elevation and we + // actually got one, we can return now. + if ((validElevation != NULL) && *validElevation) { + return true; } // If we got here, that means no tiles intersected or the user - // isn't intersted in an elevation. So, we'll just use a simple + // isn't interested in an elevation. So, we'll just use a simple // earth/ray intersection with a standard earth ellipsoid. This // will give us the lat/lon, but the elevation will always be 0 // (sea level). |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:37:32
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10733/src Modified Files: Tiles.hxx Log Message: Fixed typo. Index: Tiles.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Tiles.hxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Tiles.hxx 8 Aug 2012 20:08:14 -0000 1.10 +++ Tiles.hxx 5 Mar 2014 23:37:30 -0000 1.11 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack A group of classes for keeping track of scenery information: names, directories, which maps exist, size, latitude, longitude, .... @@ -56,7 +56,7 @@ In the TileManager, Tile, and Chunk classes, latitudes and longitudes are measured in degrees. Unless stated otherwise, latitudes must be in the range 0 <= lat < 180, and longitudes in the - range 0 <= lon < 359. A latitude of 0 corresponds to the south pole + range 0 <= lon < 360. A latitude of 0 corresponds to the south pole (-90 degrees on a regular map), and 180 to the north pole (90 degrees on a regular map). A longitude of 0 corresponds to the prime meridian (0 degrees on a regular map), 180 to the |
|
From: Brian S. <bjs...@us...> - 2014-03-05 23:12:25
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8850/src Modified Files: AirportsOverlay.cxx AirportsOverlay.hxx AirwaysOverlay.hxx Culler.cxx Culler.hxx FixesOverlay.cxx FixesOverlay.hxx FlightTrack.hxx Graphs.cxx Graphs.hxx NavaidsOverlay.cxx NavaidsOverlay.hxx Log Message: Changed annoying Bounds() method to bounds() (which meant changing the member name to _bounds). Also changed forward declaration of Navaid structs to 'struct FOO' from 'class FOO' (the compiler is pickier now). Index: Culler.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Culler.hxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Culler.hxx 4 Feb 2012 05:46:17 -0000 1.5 +++ Culler.hxx 5 Mar 2014 23:12:22 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack A simple culling structure. Atlas uses it to quickly look up navaids, airports, etc in a given area. @@ -86,7 +86,7 @@ public: virtual ~Cullable() {} - virtual const atlasSphere& Bounds() = 0; + virtual const atlasSphere& bounds() = 0; virtual double latitude() = 0; virtual double longitude() = 0; }; Index: Graphs.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Graphs.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Graphs.cxx 5 Sep 2012 05:21:44 -0000 1.22 +++ Graphs.cxx 5 Mar 2014 23:12:23 -0000 1.23 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2007 - 2012 Brian Schack + Copyright (C) 2007 - 2014 Brian Schack This file is part of Atlas. @@ -1860,7 +1860,7 @@ // x-axis) to the navaid's actual orientation. sgdMat4 rot, mat; sgdMakeRotMat4(rot, n->lon - 90.0, n->lat, -gsHeading + 180.0); - sgdMakeTransMat4(mat, n->bounds.center); + sgdMakeTransMat4(mat, n->_bounds.center); sgdPreMultMat4(mat, rot); //////////// Index: NavaidsOverlay.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavaidsOverlay.hxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- NavaidsOverlay.hxx 4 Feb 2012 05:46:17 -0000 1.9 +++ NavaidsOverlay.hxx 5 Mar 2014 23:12:23 -0000 1.10 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack Loads and draws navaids (VORs, NDBs, ILS systems, and DMEs). @@ -32,7 +32,7 @@ // Forward class declarations class Overlays; class NavData; -class NAV; +struct NAV; class FlightData; // Used for drawing labels on navaids. Index: AirportsOverlay.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AirportsOverlay.hxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AirportsOverlay.hxx 4 Feb 2012 05:46:16 -0000 1.5 +++ AirportsOverlay.hxx 5 Mar 2014 23:12:22 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2008 - 2012 Brian Schack + Copyright (C) 2008 - 2014 Brian Schack The airports overlay manages the loading and drawing of airports. @@ -37,8 +37,8 @@ // Forward class declarations class Overlays; class NavData; -class ARP; -class RWY; +struct ARP; +struct RWY; // Determines how airports are drawn. // EYE - add colours, runway label stuff, fonts? Index: FlightTrack.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/FlightTrack.hxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- FlightTrack.hxx 4 Feb 2012 05:46:17 -0000 1.20 +++ FlightTrack.hxx 5 Mar 2014 23:12:22 -0000 1.21 @@ -4,7 +4,7 @@ Written by Per Liedman, started July 2000. Copyright (C) 2000 Per Liedman, li...@ho... - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack A flight track contains the data for a FlightGear session. It includes things like the aircraft's position, speed, altitude, etc. @@ -39,7 +39,7 @@ // Forward class declarations class NavData; -class NAV; +struct NAV; class SGIOChannel; // EYE - it's wasteful to have the radio stuff in a FlightData struct, Index: AirwaysOverlay.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AirwaysOverlay.hxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AirwaysOverlay.hxx 4 Feb 2012 05:46:16 -0000 1.5 +++ AirwaysOverlay.hxx 5 Mar 2014 23:12:22 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2008 - 2012 Brian Schack + Copyright (C) 2008 - 2014 Brian Schack The airways overlay manages the loading and drawing of airways. @@ -37,7 +37,7 @@ // Forward class declarations class Overlays; class NavData; -class AWY; +struct AWY; class LayoutManager; class Overlays; Index: FixesOverlay.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/FixesOverlay.hxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- FixesOverlay.hxx 4 Feb 2012 05:46:17 -0000 1.6 +++ FixesOverlay.hxx 5 Mar 2014 23:12:22 -0000 1.7 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack The fixes overlay manages the loading and display of navigational fixes. @@ -38,7 +38,7 @@ // Forward class declarations class Overlays; class NavData; -class FIX; +struct FIX; class LayoutManager; class FixesOverlay: public Subscriber { Index: FixesOverlay.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/FixesOverlay.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- FixesOverlay.cxx 4 Feb 2012 05:46:17 -0000 1.14 +++ FixesOverlay.cxx 5 Mar 2014 23:12:22 -0000 1.15 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -152,7 +152,7 @@ // Renders the given fix. void FixesOverlay::_render(const FIX *f) { - geodPushMatrix(f->bounds.center, f->lat, f->lon); { + geodPushMatrix(f->_bounds.center, f->lat, f->lon); { glBegin(GL_POINTS); { glVertex2f(0.0, 0.0); } @@ -173,7 +173,7 @@ lm.setText(f->name); lm.moveTo(-labelOffset, 0.0, LayoutManager::CR); - geodDrawText(lm, f->bounds.center, f->lat, f->lon); + geodDrawText(lm, f->_bounds.center, f->lat, f->lon); } // Called when somebody posts a notification that we've subscribed to. Index: NavaidsOverlay.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/NavaidsOverlay.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- NavaidsOverlay.cxx 4 Feb 2012 05:46:17 -0000 1.22 +++ NavaidsOverlay.cxx 5 Mar 2014 23:12:23 -0000 1.23 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -959,7 +959,7 @@ radius = maxVORSize; } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { //////////////////// // VOR icon //////////////////// @@ -1137,7 +1137,7 @@ live = true; } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { glPushMatrix(); { //////////////////// // NDB icon @@ -1282,7 +1282,7 @@ labelPointSize = labelPointSize * 50.0 / _metresPerPixel; } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { glPushMatrix(); { glRotatef(-n->magvar, 0.0, 0.0, 1.0); glScalef(ilsLength, ilsLength, ilsLength); @@ -1405,7 +1405,7 @@ } } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { glRotatef(-n->magvar + 90.0, 0.0, 0.0, 1.0); if (n->navtype == NAV_OM) { glCallList(_ILSMarkerDLs[0]); @@ -1438,7 +1438,7 @@ radius = maxDMESize; } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { //////////////////// // DME icon //////////////////// @@ -1504,7 +1504,7 @@ radius = maxDMESize; } - geodPushMatrix(n->bounds.center, n->lat, n->lon); { + geodPushMatrix(n->_bounds.center, n->lat, n->lon); { //////////////////// // DME icon //////////////////// Index: Graphs.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Graphs.hxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Graphs.hxx 5 Sep 2012 05:21:44 -0000 1.13 +++ Graphs.hxx 5 Mar 2014 23:12:23 -0000 1.14 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2007 - 2012 Brian Schack + Copyright (C) 2007 - 2014 Brian Schack The graphs object draws graphs for a flight track in a window. @@ -37,7 +37,7 @@ // Forward class declarations class AtlasController; class FlightTrack; -class NAV; +struct NAV; class GraphsUI; class GraphsWindow: public AtlasBaseWindow, Subscriber { Index: Culler.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Culler.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Culler.cxx 4 Feb 2012 05:46:17 -0000 1.7 +++ Culler.cxx 5 Mar 2014 23:12:22 -0000 1.8 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2014 Brian Schack This file is part of Atlas. @@ -267,7 +267,7 @@ largest++; } #endif - _bounds.extend(&(obj->Bounds())); + _bounds.extend(&(obj->bounds())); } void Culler::Leaf::intersections(const sgdFrustum& frustum, sgdMat4 m, @@ -292,7 +292,7 @@ for (unsigned int i = 0; i < children.size(); i++) { Cullable *c = children[i]; - tmp = c->Bounds(); + tmp = c->bounds(); tmp.orthoXform(m); result = frustum.contains(&tmp); if (result != SG_OUTSIDE) { @@ -321,8 +321,8 @@ for (unsigned int i = 0; i < children.size(); i++) { Cullable *c = children[i]; - result = sgdDistanceVec3(point, c->Bounds().getCenter()); - if (result <= c->Bounds().getRadius()) { + result = sgdDistanceVec3(point, c->bounds().getCenter()); + if (result <= c->bounds().getRadius()) { intersections.push_back(c); } } Index: AirportsOverlay.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/AirportsOverlay.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- AirportsOverlay.cxx 4 Feb 2012 05:46:16 -0000 1.15 +++ AirportsOverlay.cxx 5 Mar 2014 23:12:22 -0000 1.16 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2008 - 2012 Brian Schack + Copyright (C) 2008 - 2014 Brian Schack This file is part of Atlas. @@ -45,8 +45,6 @@ using namespace std; -void airportLatLon(ARP *ap); -void runwayExtents(RWY *rwy, float elev); void drawRunway(RWY *rwy, float border = 0.0); // EYE - move to policy? @@ -301,7 +299,7 @@ colour = arp_uncontrolled_colour; } - rA = ap->bounds.radius / _metresPerPixel; // pixels + rA = ap->_bounds.radius / _metresPerPixel; // pixels if (rA > rI) { glColor4fv(colour); for (unsigned int j = 0; j < ap->rwys.size(); j++) { @@ -352,7 +350,7 @@ continue; } - rA = ap->bounds.radius / _metresPerPixel; // pixels + rA = ap->_bounds.radius / _metresPerPixel; // pixels if (rA > rAMin) { for (unsigned int j = 0; j < ap->rwys.size(); j++) { @@ -382,7 +380,7 @@ if (!ap) { continue; } - rA = ap->bounds.radius / _metresPerPixel; // pixels + rA = ap->_bounds.radius / _metresPerPixel; // pixels // Only draw the beacon if it has one and if the airport // is being drawn as an airport (outlined runways). @@ -448,7 +446,7 @@ continue; } - rA = ap->bounds.radius / _metresPerPixel; // pixels + rA = ap->_bounds.radius / _metresPerPixel; // pixels if (rA > rI) { for (unsigned int j = 0; j < ap->rwys.size(); j++) { RWY *rwy = ap->rwys[j]; @@ -468,7 +466,7 @@ // We don't label airports unless they're at least the // minimum size. - rA = ap->bounds.radius / _metresPerPixel; + rA = ap->_bounds.radius / _metresPerPixel; if (rA > rMin) { _labelAirport(ap, rA); } @@ -544,7 +542,7 @@ { // Radius is passed in in pixels; we convert it to metres radius = radius * _metresPerPixel; - geodPushMatrix(ap->bounds.center, ap->lat, ap->lon); { + geodPushMatrix(ap->_bounds.center, ap->lat, ap->lon); { glScalef(radius, radius, radius); glCallList(_airportIconDL); } @@ -771,10 +769,9 @@ // Add runway length and width. According to Canadian rules, // width is indicated only if different than 200', the standard // width. Length is drawn alongside the runway (to the foot). - // Diagrams also indicated slope, actual magnetic heading, - // lighting symbols (eg, dots down the runway to indicate centre - // lighting), runway threshold elevation in feet, magnetic - // variation. + // Diagrams also indicate slope, actual magnetic heading, lighting + // symbols (eg, dots down the runway to indicate centre lighting), + // runway threshold elevation in feet, magnetic variation. // // British charts indicate lengths in metres (and always write // both, in the form length x width). They also show the highest |
|
From: Brian S. <bjs...@us...> - 2013-12-03 05:10:08
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13231/src Modified Files: Background.cxx Log Message: Replaced unsightly &_vector[0] calls with vector.data(). Index: Background.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Background.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Background.cxx 24 Aug 2012 23:13:14 -0000 1.5 +++ Background.cxx 3 Dec 2013 05:10:06 -0000 1.6 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2012 Brian Schack + Copyright (C) 2012 - 2013 Brian Schack This file is part of Atlas. @@ -264,16 +264,16 @@ // Specify the vertices. glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, &_vertices[0]); + glVertexPointer(3, GL_FLOAT, 0, _vertices.data()); // Specify the textures. glClientActiveTexture(GL_TEXTURE0); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, 0, &_imageTexCoords[0]); + glTexCoordPointer(2, GL_FLOAT, 0, _imageTexCoords.data()); glClientActiveTexture(GL_TEXTURE1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, 0, &_statusTexCoords[0]); + glTexCoordPointer(2, GL_FLOAT, 0, _statusTexCoords.data()); // Draw. glMultiDrawElements(GL_TRIANGLE_STRIP, _counts, @@ -306,10 +306,10 @@ // Tell OpenGL where the vertex data is. // EYE - use glBindBuffer? - glVertexPointer(3, GL_FLOAT, 0, &_vertices[0]); + glVertexPointer(3, GL_FLOAT, 0, _vertices.data()); glEnableClientState(GL_VERTEX_ARRAY); glDrawElements(GL_LINES, _latLonLines.size(), - GL_UNSIGNED_INT, &(_latLonLines[0])); + GL_UNSIGNED_INT, _latLonLines.data()); } glEndList(); glPopClientAttrib(); @@ -330,7 +330,7 @@ // Tell OpenGL where the vertex data is and enable // them. - glVertexPointer(3, GL_FLOAT, 0, &_vertices[0]); + glVertexPointer(3, GL_FLOAT, 0, _vertices.data()); glEnableClientState(GL_VERTEX_ARRAY); // Chunk boundary @@ -349,7 +349,7 @@ glColor3f(0.25, 1.0, 1.0); vector<GLuint>& civ = ci->second; glDrawElements(GL_LINES, civ.size(), - GL_UNSIGNED_INT, &(civ[0])); + GL_UNSIGNED_INT, civ.data()); } // Tile boundary @@ -360,7 +360,7 @@ glColor3f(1.0, 0.25, 1.0); vector<GLuint>& tiv = ti->second; glDrawElements(GL_LINES, tiv.size(), - GL_UNSIGNED_INT, &(tiv[0])); + GL_UNSIGNED_INT, tiv.data()); } } glPopAttrib(); |
|
From: Brian S. <bjs...@us...> - 2013-12-03 05:08:50
|
Update of /cvsroot/atlas/Atlas/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13114/src Modified Files: Palette.cxx Palette.hxx Log Message: Changed _offsetElevations from a deque to a vector for performance reasons. Index: Palette.hxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Palette.hxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Palette.hxx 4 Feb 2012 05:46:17 -0000 1.6 +++ Palette.hxx 3 Dec 2013 05:08:48 -0000 1.7 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2013 Brian Schack A palette tells Atlas (and Map) how to colour maps. It specifies colours for elevations and materials. The palette object can load @@ -29,9 +29,10 @@ #ifndef _PALETTE_H_ #define _PALETTE_H_ -#include <deque> -#include <map> #include <string> +#include <map> +#include <deque> +#include <vector> #include <plib/sg.h> // sgVec4 @@ -101,7 +102,10 @@ // Deque of <elevation, colour> pairs. The first and last pairs // are generated internally by the Palette class to make // calculating smooth colour values easier. - std::deque<Contour> _elevations, _offsetElevations; + std::deque<Contour> _elevations; + // This is a copy of _elevations, but with all elevations offset + // by _base. + std::vector<Contour> _offsetElevations; // Index of last colour index returned from contourIndex(). I'm // guessing that successive calls to this method will be for Index: Palette.cxx =================================================================== RCS file: /cvsroot/atlas/Atlas/src/Palette.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Palette.cxx 4 Feb 2012 05:46:17 -0000 1.10 +++ Palette.cxx 3 Dec 2013 05:08:48 -0000 1.11 @@ -3,7 +3,7 @@ Written by Brian Schack - Copyright (C) 2009 - 2012 Brian Schack + Copyright (C) 2009 - 2013 Brian Schack This file is part of Atlas. @@ -153,9 +153,12 @@ fake.elevation += _elevations[i].elevation - _elevations[i - 1].elevation; _elevations.push_back(fake); - // Copy the raw elevations data in _elevations to ones offset by - // _base, in _offsetElevations. - _offsetElevations = _elevations; + // Copy the raw elevation data into _offsetElevations. When + // setBase() is called, _offsetElevations will be changed - + // _elevations never changes. + for (size_t i = 0; i < _elevations.size(); i++) { + _offsetElevations.push_back(_elevations[i]); + } _path = path; } |