How stephengold/v-sport works
Purpose and module layout
V-Sport is a Java Vulkan rendering engine designed to visualize Libbulletjme physics. The Gradle multi-project build separates the reusable engine in lib/ from executable demos, tutorials, and manual tests in apps/. Core build/module definitions are settings.gradle, lib/build.gradle, and apps/build.gradle.
Application entry model
Applications extend the physics-aware base class, initialize a physics space, populate it, and update it before rendering. The principal lifecycle boundary is lib/src/main/java/com/github/stephengold/vsport/physics/BasePhysicsApp.java, built on lib/src/main/java/com/github/stephengold/vsport/BaseApplication.java. Runnable examples include apps/src/main/java/com/github/stephengold/vsport/tutorial/HelloSport.java and the Swing launcher apps/src/main/java/com/github/stephengold/vsport/demo/AppChooser.java.
Vulkan runtime and frame pipeline
BaseApplication owns engine lifecycle; Vulkan-facing setup and device selection are organized around PhysicalDevice, LogicalDevice, and internal state in lib/src/main/java/com/github/stephengold/vsport/PhysicalDevice.java, lib/src/main/java/com/github/stephengold/vsport/LogicalDevice.java, and lib/src/main/java/com/github/stephengold/vsport/Internals.java. Per-frame synchronization, command recording, and presentation flow through Frame, CommandSequence, and swapchain-related resources such as lib/src/main/java/com/github/stephengold/vsport/Frame.java and lib/src/main/java/com/github/stephengold/vsport/ChainResources.java.
Renderable-object boundary
There is no scene graph. Constructing a Geometry registers it in the engine’s internal renderable list; application code therefore controls visibility through geometry lifetime. Geometry combines mesh/material-like shader inputs and draw state, centered on lib/src/main/java/com/github/stephengold/vsport/Geometry.java, lib/src/main/java/com/github/stephengold/vsport/Mesh.java, and lib/src/main/java/com/github/stephengold/vsport/Draw.java. Standard procedural meshes live under lib/src/main/java/com/github/stephengold/vsport/mesh/.
GPU assets, shaders, and camera data
CPU mesh data becomes Vulkan buffers/images through resource wrappers including lib/src/main/java/com/github/stephengold/vsport/VertexBuffer.java, lib/src/main/java/com/github/stephengold/vsport/DeviceImage.java, and lib/src/main/java/com/github/stephengold/vsport/Texture.java. Shader programs and uniform inputs bridge rendering state to GLSL/SPIR-V compilation/loading: lib/src/main/java/com/github/stephengold/vsport/ShaderProgram.java, lib/src/main/java/com/github/stephengold/vsport/GlobalUniformValues.java, and lib/src/main/resources/Shaders/. Camera/projection state is isolated in lib/src/main/java/com/github/stephengold/vsport/Camera.java and lib/src/main/java/com/github/stephengold/vsport/Projection.java.
Physics visualization layer
The physics package adapts Libbulletjme collision objects, constraints, vehicles, and soft bodies into geometries rather than modifying the physics engine. lib/src/main/java/com/github/stephengold/vsport/physics/RigidBodyShapeGeometry.java, lib/src/main/java/com/github/stephengold/vsport/physics/ConstraintGeometry.java, and lib/src/main/java/com/github/stephengold/vsport/physics/ShapeMesh.java define this boundary. Frame updates synchronize these visualizations with physics-space state.
Input, imports, and external runtime dependencies
GLFW-backed input is routed through processors in lib/src/main/java/com/github/stephengold/vsport/input/InputManager.java and lib/src/main/java/com/github/stephengold/vsport/input/CameraInputProcessor.java. Model importing uses Assimp via lib/src/main/java/com/github/stephengold/vsport/importers/AssimpUtils.java. Runtime depends on Vulkan through LWJGL, GLFW, Assimp, JOML, jSnapLoader, and Libbulletjme native libraries; consumers must explicitly select platform-native Libbulletjme and LWJGL artifacts.
Main entry points: BaseApplication.java BaseApplication · Frame.java Frame pipeline · BasePhysicsApp.java BasePhysicsApp · RigidBodyShapeGeometry.java Physics geometries
Components 21
Gradle modules
Reusable engine and runnable applications are separate modules.
- Multi-project build
settings.gradle - Engine module
lib/build.gradle - Apps module
apps/build.gradle
V-Sport engine
- BaseApplication · Owns engine lifecycle and Vulkan runtime orchestration.
lib/src/main/java/com/github/stephengold/vsport/BaseApplication.java - Vulkan devices · Physical-device selection and logical-device creation.
lib/src/main/java/com/github/stephengold/vsport/PhysicalDevice.java - Internals
lib/src/main/java/com/github/stephengold/vsport/Internals.java - Frame pipeline · Synchronizes, records commands, and presents swapchain frames.
lib/src/main/java/com/github/stephengold/vsport/Frame.java - Swapchain resources
lib/src/main/java/com/github/stephengold/vsport/ChainResources.java - Geometry · Construction registers a renderable; lifetime controls visibility.
lib/src/main/java/com/github/stephengold/vsport/Geometry.java - Mesh and draw state
lib/src/main/java/com/github/stephengold/vsport/Mesh.java - GPU assets · Uploads CPU mesh and texture data into Vulkan resources.
lib/src/main/java/com/github/stephengold/vsport/VertexBuffer.java - Shaders and uniforms
lib/src/main/java/com/github/stephengold/vsport/ShaderProgram.java - Camera and projection
lib/src/main/java/com/github/stephengold/vsport/Camera.java - Input manager
lib/src/main/java/com/github/stephengold/vsport/input/InputManager.java - Assimp importer
lib/src/main/java/com/github/stephengold/vsport/importers/AssimpUtils.java
Physics visualization
- BasePhysicsApp · Initializes and updates the physics space before rendering.
lib/src/main/java/com/github/stephengold/vsport/physics/BasePhysicsApp.java - Physics geometries · Maps collision objects and constraints to engine geometries.
lib/src/main/java/com/github/stephengold/vsport/physics/RigidBodyShapeGeometry.java - ShapeMesh
lib/src/main/java/com/github/stephengold/vsport/physics/ShapeMesh.java
Applications
- HelloSport
apps/src/main/java/com/github/stephengold/vsport/tutorial/HelloSport.java - AppChooser
apps/src/main/java/com/github/stephengold/vsport/demo/AppChooser.java
Other components
- Native runtime · LWJGL Vulkan, GLFW, Assimp, and Libbulletjme native artifacts.
Connections 23
- Multi-project build → Engine module: includes
- Multi-project build → Apps module: includes
- Apps module → Engine module: depends on
- HelloSport → BasePhysicsApp: extends
- BasePhysicsApp → BaseApplication: extends
- BasePhysicsApp → Physics geometries: updates
- Physics geometries → ShapeMesh: builds meshes
- Physics geometries → Geometry: creates
- BaseApplication → Vulkan devices: initializes
- BaseApplication → Internals: owns
- BaseApplication → Frame pipeline: runs per frame
- Vulkan devices → Native runtime: uses Vulkan
- Frame pipeline → Swapchain resources: uses
- Frame pipeline → Geometry: renders registered
- Geometry → Mesh and draw state: combines
- Mesh and draw state → GPU assets: uploads through
- Frame pipeline → Shaders and uniforms: binds
- Camera and projection → Shaders and uniforms: supplies uniforms
- Input manager → Camera and projection: controls
- Assimp importer → Mesh and draw state: loads models into
- Input manager → Native runtime: uses GLFW
- Assimp importer → Native runtime: uses Assimp
- AppChooser → HelloSport: launches examples