Skip to content

Instantly share code, notes, and snippets.

@Jordach

Jordach/sky.cpp Secret

Last active March 6, 2020 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jordach/5304356f7557bee0b72fa8b66f35a7b9 to your computer and use it in GitHub Desktop.
Save Jordach/5304356f7557bee0b72fa8b66f35a7b9 to your computer and use it in GitHub Desktop.
void Sky::setStarCount(u16 star_count, bool force_update)
{
// Force updating star count at game init.
if (m_star_params.count != star_count || force_update) {
m_star_params.count = star_count;
m_stars.clear();
// Rebuild the stars surrounding the camera
for (u16 i = 0; i < star_count; i++) {
v3f star = v3f(
myrand_range(-10000, 10000),
myrand_range(-10000, 10000),
myrand_range(-10000, 10000)
);
star.normalize();
m_stars.emplace_back(star);
}
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment