Manages and renders a camera-centered field of animated stars. More...
#include <examples/asteroids-net/starfield.hpp>
Public Member Functions | |
| void | draw () |
| Submits the current stars to the assigned sprite batch. | |
| void | draw () |
| void | init (int star_count, float min_radius, float max_radius) |
| Creates the stars. | |
| void | init (int star_count, float min_radius, float max_radius) |
| void | resize (mxvk::VK_Window *window) |
| Updates rendering resources after a window-size change. | |
| void | resize (mxvk::VK_Window *window) |
| void | setSprite (mxvk::VK_Sprite3D *sprite_batch) |
| Assigns the non-owning sprite batch used to render stars. | |
| void | setSprite (mxvk::VK_Sprite3D *sprite_batch) |
| StarField ()=default | |
| Creates an uninitialized starfield. | |
| StarField ()=default | |
| void | update (float delta_time, const glm::vec3 &camera_position, float elapsed_time) |
| Advances star movement and twinkling. | |
| void | update (float delta_time, const glm::vec3 &camera_position, float elapsed_time) |
Manages and renders a camera-centered field of animated stars.
Definition at line 22 of file starfield.hpp.
|
default |
Creates an uninitialized starfield.
|
default |
| void space::StarField::draw | ( | ) |
Submits the current stars to the assigned sprite batch.
Definition at line 50 of file starfield.cpp.
| void space::StarField::draw | ( | ) |
| void space::StarField::init | ( | int | star_count, |
| float | min_radius, | ||
| float | max_radius ) |
Creates the stars.
| star_count | Number of stars. |
| min_radius | Inner spawn radius. |
| max_radius | Outer spawn radius. |
Definition at line 7 of file starfield.cpp.
| void space::StarField::init | ( | int | star_count, |
| float | min_radius, | ||
| float | max_radius ) |
| void space::StarField::resize | ( | mxvk::VK_Window * | window | ) |
Updates rendering resources after a window-size change.
| window | Active rendering window. |
Definition at line 25 of file starfield.cpp.
| void space::StarField::resize | ( | mxvk::VK_Window * | window | ) |
| void space::StarField::setSprite | ( | mxvk::VK_Sprite3D * | sprite_batch | ) |
Assigns the non-owning sprite batch used to render stars.
| sprite_batch | Sprite batch, which must outlive this object. |
Definition at line 21 of file starfield.cpp.
| void space::StarField::setSprite | ( | mxvk::VK_Sprite3D * | sprite_batch | ) |
| void space::StarField::update | ( | float | delta_time, |
| const glm::vec3 & | camera_position, | ||
| float | elapsed_time ) |
Advances star movement and twinkling.
| delta_time | Frame duration in seconds. |
| camera_position | Current camera position. |
| elapsed_time | Total elapsed time in seconds. |
Definition at line 31 of file starfield.cpp.
| void space::StarField::update | ( | float | delta_time, |
| const glm::vec3 & | camera_position, | ||
| float | elapsed_time ) |