Skip to content

PTX Engine

PTX Engine is the next-generation evolution of ProtoTracer - a header-first C++17 library providing a compact math, geometry, and rendering core designed to run on both microcontrollers and desktop platforms.

View PTX Engine on GitHub


FeatureProtoTracerPTX Engine
Language StandardC++11C++17
Desktop SupportNoYes
Header-FirstNoYes
Runtime ReflectionNoYes
Python BindingsNoYes (ctypes)
8-bit AVR SupportNoYes

PTX Engine is designed for cross-platform development:

  • 32-bit Cortex-M (STM32, Teensy)
  • ESP32 (ESP32-S3)
  • 8-bit AVR (Arduino UNO, Nano)
  • Linux
  • Windows

The entire library is usable as header files, making it easy to integrate into any project without complex build configurations.

PTX Engine includes a reflection system for runtime discovery and invocation of types and members. This enables:

  • Dynamic type introspection
  • Runtime method invocation
  • Automated serialization
  • Binding generation

A ctypes-based Python wrapper allows you to:

  • Explore reflection metadata
  • Test engine functionality from Python
  • Rapid prototyping without recompiling

The reflection system compiles into a shared library:

Terminal window
# From repository root
platformio run --environment nativereflectlib

The produced shared library will be at:

.pio/build/nativereflectlib/ptx_reflect.so
Terminal window
cd lib/ptx_python
PYTHONPATH=../../src python3 reflection_demo.py --lib ../../.pio/build/nativereflectlib/ptx_reflect.so

Or set the environment variable:

Terminal window
export PTX_C_API_LIB=/full/path/to/ptx_reflect.so
PYTHONPATH=../../src python3 reflection_demo.py

The project is actively being developed with recent work focusing on:

  1. Runtime Reflection System - Generator and build scripts for automatic registration
  2. C ABI Layer - Stable interface for language bindings
  3. Python Wrapper - ctypes-based exploration of reflection metadata

DirectoryPurpose
engine/Core engine code
bindings/Language bindings
scripts/Build and generation scripts
tests/Unit tests
src/Main source and entry points

Terminal window
cmake --build build --target ptx_update_registry

This regenerates:

  • Umbrella header (generated/ptx/ptxall.hpp)
  • PTX registry cache

Static utility namespaces (e.g., ptx::Console, ptx::Random, ptx::Time) expose a nested Reflection struct that forwards to their static functions. Follow this pattern for other static-only modules that need runtime access.


See CONTRIBUTING.md in the repository for:

  • Coding style guidelines
  • Platform-specific guidance
  • Pull request process

PTX Engine is released under the AGPL-3.0 license.