File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -830,6 +830,7 @@ void Sky::setStarCount(u16 star_count, bool force_update)
830
830
// Allow force updating star count at game init.
831
831
if (m_star_params.count != star_count || force_update) {
832
832
m_star_params.count = star_count;
833
+ m_seed = (u64)myrand () << 32 | myrand ();
833
834
updateStars ();
834
835
}
835
836
}
@@ -847,12 +848,13 @@ void Sky::updateStars() {
847
848
m_stars->Vertices .reallocate (4 * m_star_params.count );
848
849
m_stars->Indices .reallocate (6 * m_star_params.count );
849
850
851
+ PcgRandom rgen (m_seed);
850
852
float d = (0.006 / 2 ) * m_star_params.scale ;
851
853
for (u16 i = 0 ; i < m_star_params.count ; i++) {
852
854
v3f r = v3f (
853
- myrand_range (-10000 , 10000 ),
854
- myrand_range (-10000 , 10000 ),
855
- myrand_range (-10000 , 10000 )
855
+ rgen. range (-10000 , 10000 ),
856
+ rgen. range (-10000 , 10000 ),
857
+ rgen. range (-10000 , 10000 )
856
858
);
857
859
core::CMatrix4<f32> a;
858
860
a.buildRotateFromTo (v3f (0 , 1 , 0 ), r);
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ class Sky : public scene::ISceneNode
179
179
180
180
bool m_default_tint = true ;
181
181
182
+ u64 m_seed = 0 ;
182
183
irr_ptr<scene::SMeshBuffer> m_stars;
183
184
184
185
video::ITexture *m_sun_texture;
You can’t perform that action at this time.
0 commit comments