MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
asteroids3d_types.hpp File Reference

Shared simulation constants, data types, and utility functions. More...

#include "mxvk/mxvk_exception.hpp"
#include "mxvk/mxvk_png.hpp"
#include <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <random>
#include <string>
#include <vector>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>

Go to the source code of this file.

Classes

struct  space::Asteroid
 Runtime state for an asteroid. More...
struct  space::FlamePushConstants
 Push-constant payload for the engine-flame shaders. More...
struct  space::FlameVertex
 Vertex consumed by the procedural engine-flame pipeline. More...
struct  space::Particle
 Runtime state for an explosion or engine particle. More...
struct  space::Projectile
 Runtime state for a ship projectile. More...
struct  space::ShipCollisionSample
 One spherical sample used by the compound ship collision shape. More...
struct  space::Star
 Runtime state for one animated background star. More...

Namespaces

namespace  space

Enumerations

enum class  space::GameMode {
  space::Intro , space::Loading , space::Lobby , space::Playing ,
  space::MatchOver , space::GameComplete , space::GameOver , space::Intro ,
  space::Loading , space::Playing , space::GameComplete , space::GameOver
}
 High-level state of the Asteroids application. More...

Functions

glm::mat4 space::build_model_matrix (const glm::vec3 &position, const glm::vec3 &rotation_degrees, float scale, const glm::vec3 &center_offset)
 Builds a translated, rotated, scaled model matrix.
SDL_Surface * space::load_color_keyed_png (const std::string &path, std::uint8_t threshold=12, std::uint8_t softness=48)
 Loads a PNG and fades dark color-key pixels to transparency.
glm::vec3 space::normalize_or_zero (const glm::vec3 &value)
 Normalizes a direction with a stable fallback.
float space::random_float (float min_value, float max_value)
 Generates a uniformly distributed floating-point value.
int space::random_int (int min_value, int max_value)
 Generates a uniformly distributed integer.
std::default_random_engine & space::rng ()
 Returns the thread-local random number engine used by simulation helpers.

Variables

Simulation constants
constexpr float space::ASTEROID_PROJECTILE_COLLISION_SCALE = 1.18f
 Projectile collision-radius adjustment.
constexpr float space::ASTEROID_SHIP_COLLISION_SCALE = 1.08f
 Ship collision-radius adjustment.
constexpr float space::BOUNDARY_BOUNCE_FACTOR = 1.2f
 Boundary collision response multiplier.
constexpr float space::BOUNDARY_X_MAX = 150.0f
 Maximum simulation x-coordinate.
constexpr float space::BOUNDARY_X_MIN = -150.0f
 Minimum simulation x-coordinate.
constexpr float space::BOUNDARY_Y_MAX = 100.0f
 Maximum simulation y-coordinate.
constexpr float space::BOUNDARY_Y_MIN = -100.0f
 Minimum simulation y-coordinate.
constexpr float space::BOUNDARY_Z_MAX = 150.0f
 Maximum simulation z-coordinate.
constexpr float space::BOUNDARY_Z_MIN = -150.0f
 Minimum simulation z-coordinate.
constexpr int space::CHILDREN_PER_SPAWN = 2
 Child asteroids created by a split.
constexpr float space::CONTROLLER_AXIS_MAX = 32767.0f
 Maximum signed controller axis magnitude.
constexpr Sint16 space::CONTROLLER_DEAD_ZONE = 8000
 Controller axis dead-zone magnitude.
constexpr int space::EXPLOSION_DURATION_FRAMES = 90
 Ship explosion duration in frames.
constexpr int space::FIRE_COOLDOWN = 5
 Frames between firing bursts.
constexpr int space::FIRE_DELAY = 3
 Frames between shots within a burst.
constexpr int space::GAME_STARS = 22000
 Number of stars in the background field.
constexpr int space::LARGE_ASTEROID_POINTS = 20
 Score awarded for a large asteroid.
constexpr int space::MAX_ASTEROIDS = 64
 Maximum locally simulated asteroids.
constexpr int space::MAX_GENERATIONS = 1
 Maximum asteroid split generation.
constexpr int space::MAX_PARTICLES = 6000
 Maximum particles in the shared particle pool.
constexpr int space::MAX_PROJECTILES = 64
 Maximum locally simulated projectiles.
constexpr int space::MEDIUM_ASTEROID_POINTS = 50
 Score awarded for a medium asteroid.
constexpr float space::PI = 3.14159265358979323846f
 Single-precision value of pi.
constexpr glm::vec4 space::PROJECTILE_COLOR {1.0f, 0.58f, 0.12f, 1.0f}
 Default projectile color.
constexpr float space::PROJECTILE_LIFETIME = 3.0f
 Projectile lifetime in seconds.
constexpr float space::PROJECTILE_SPEED = 52.0f
 Projectile travel speed in world units per second.
constexpr float space::ROUND_TIME_LIMIT_SECONDS = 270.0f
 Multiplayer round limit in seconds.
constexpr float space::SHIP_MODEL_SCALE = 1.55f
 Uniform ship model scale.
constexpr int space::SHOTS_PER_BURST = 5
 Projectiles fired in one burst.
constexpr int space::SMALL_ASTEROID_POINTS = 100
 Score awarded for a small asteroid.

Detailed Description

Shared simulation constants, data types, and utility functions.

Definition in file asteroids3d_types.hpp.