MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
starfield.hpp
Go to the documentation of this file.
1#ifndef ASTEROIDS3D_STARFIELD_HPP
2#define ASTEROIDS3D_STARFIELD_HPP
3
5
6namespace mxvk {
7 class VK_Sprite3D;
8 class VK_Window;
9} // namespace mxvk
10
11namespace space {
12
13 class StarField {
14 public:
15 StarField() = default;
16
17 void init(int star_count, float min_radius, float max_radius);
18 void setSprite(mxvk::VK_Sprite3D *sprite_batch);
19 void resize(mxvk::VK_Window *window);
20 void update(float delta_time, const glm::vec3 &camera_position, float elapsed_time);
21 void draw();
22
23 private:
24 std::vector<Star> stars{};
25 mxvk::VK_Sprite3D *sprite = nullptr;
26 bool initialized = false;
27 float min_radius = 50.0f;
28 float max_radius = 200.0f;
29
30 void respawn(Star &star, const glm::vec3 &center);
31 };
32
33} // namespace space
34
35#endif
Depth-tested 3D billboard sprite batch.
Main Vulkan window wrapper for MXVK.
Definition mxvk.hpp:37
Manages and renders a camera-centered field of animated stars.
Definition starfield.hpp:22
void init(int star_count, float min_radius, float max_radius)
void setSprite(mxvk::VK_Sprite3D *sprite_batch)
void update(float delta_time, const glm::vec3 &camera_position, float elapsed_time)
StarField()=default
void resize(mxvk::VK_Window *window)
Utilities for loading and saving PNG images.
Definition mxvk.hpp:30
Runtime state for one animated background star.