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

Files

 
planet.cpp

Detailed Description

Planet Example

image

Planet Example renders a rotating Saturn model with a texture-mapped ring and a controllable orbital camera. It is a compact example of loading a compressed model, disabling backface culling, and driving the view from mouse input. The scene also layers a matrix-style green rain backdrop behind the planet using a live VK_Sprite updated from an SDL surface every frame.

Controls

  • Left mouse drag - orbit the camera around the planet
  • Mouse wheel - zoom in or out
  • Escape - quit

How It Works

The example loads saturn.mxmod.z and its texture manifest, then feeds a continuously rotating model matrix into the standard MXVK model pipeline. In parallel, it builds a glyph atlas from the bundled bold Noto Sans CJK JP font, animates the rain into an off-screen surface, and uploads that surface into a sprite that is rendered before the planet. The camera is placed slightly above the equator so the ring is visible from the start.

The rain font size can be changed with --font-size <px>, and the font file itself can be overridden with --font-path <file>. Passing --binary switches the glyph set to 0 and 1 and uses the bundled binary.ttf font by default. The bundled default without --binary is the bold Japanese face. The rain tint can also be changed with --color <spec> using either #RRGGBB or R,G,B.