00001 #include "starfld.h" 00002 00007 #include <glt/rgb.h> 00008 00009 #include <node/line.h> 00010 #include <node/interp.h> 00011 00012 #include <math/random.h> 00013 00014 GltStarField::GltStarField(const int n,const int layers) 00015 { 00016 double duration = 60.0; 00017 00018 for (int i=0; i<layers; i++) 00019 { 00020 GltLine *stars = new GltLine(); 00021 stars->solid() = false; 00022 stars->color() = white; 00023 00024 GltRandomSphere<> pos(3.0); 00025 00026 for (int j=0; j<n; j++) 00027 stars->points().push_back(pos.rand()); 00028 00029 GltInterpolatorRotation *interp = new GltInterpolatorRotation(stars->transformation()); 00030 interp->axis() = VectorY; 00031 interp->start(duration,true); 00032 00033 push_back(interp); 00034 push_back(stars); 00035 00036 // Each subsequent 'layer' is faster 00037 duration *= 0.7; 00038 } 00039 } 00040 00041 GltStarField::~GltStarField() 00042 { 00043 } 00044