00001 // stars.hxx -- model the stars 00002 // 00003 // Written by Durk Talsma. Originally started October 1997, for distribution 00004 // with the FlightGear project. Version 2 was written in August and 00005 // September 1998. This code is based upon algorithms and data kindly 00006 // provided by Mr. Paul Schlyter. (pausch@saaf.se). 00007 // 00008 // Separated out rendering pieces and converted to ssg by Curt Olson, 00009 // March 2000 00010 // 00011 // This library is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU Library General Public 00013 // License as published by the Free Software Foundation; either 00014 // version 2 of the License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with this program; if not, write to the Free Software 00023 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00024 // 00025 // $Id: stars_8hxx_source.html,v 1.3 2010/02/23 22:10:16 curt Exp $ 00026 00027 00028 #ifndef _SG_STARS_HXX_ 00029 #define _SG_STARS_HXX_ 00030 00031 00032 #include <osg/Array> 00033 00034 #include <simgear/math/SGMath.hxx> 00035 #include <simgear/structure/SGReferenced.hxx> 00036 00037 00038 class SGStars : public SGReferenced { 00039 00040 osg::ref_ptr<osg::Vec4Array> cl; 00041 00042 int old_phase; // data for optimization 00043 00044 public: 00045 00046 // Constructor 00047 SGStars( void ); 00048 00049 // Destructor 00050 ~SGStars( void ); 00051 00052 // initialize the stars structure 00053 osg::Node* build( int num, const SGVec3d star_data[], double star_dist ); 00054 00055 // repaint the planet magnitudes based on current value of 00056 // sun_angle in degrees relative to verticle (so we can make them 00057 // relatively dimmer during dawn and dusk 00058 // 0 degrees = high noon 00059 // 90 degrees = sun rise/set 00060 // 180 degrees = darkest midnight 00061 bool repaint( double sun_angle, int num, const SGVec3d star_data[] ); 00062 }; 00063 00064 00065 #endif // _SG_STARS_HXX_