sable 0.1.0

A modular 3D/2.5D game engine with multi-backend rendering
Documentation
# Sable Engine

A modular 3D/2.5D game engine built in Rust, focusing on modern graphics APIs and excellent developer experience.

[![License](https://img.shields.io/badge/license-Proprietary-red.svg)](LICENSE)
[![Rust](https://img.shields.io/badge/rust-2024%20edition-orange.svg)](https://www.rust-lang.org/)

## Features

- **Multi-Backend Rendering** — Vulkan (primary), Metal (macOS/iOS), DirectX 12 (Windows)
- **2D & 3D Support** — Full 3D rendering with first-class 2.5D/sprite support
- **Live2D-Style Animation** — Mesh deformation, physics-based hair/cloth, lip sync
- **Scripting** — Lua, Rhai, and WebAssembly scripting with hot-reload
- **Visual Editor** — Scene editing, asset browsing, profiling tools
- **Modern Rust** — 2024 edition, proc-macros for ergonomic APIs, zero-cost abstractions

## Quick Start

```rust
use sable::prelude::*;

fn main() {
    // Math types
    let position = Vec3::new(1.0, 2.0, 3.0);
    let rotation = Quat::from_axis_angle(Vec3::Y, radians(45.0));
    let transform = Mat4::from_translation(position) * rotation.to_mat4();

    // Colors
    let color = Srgba::from_hex(0xFF5500);
    let linear = color.to_linear(); // For GPU operations

    // Generational handles for safe resource management
    let mut textures = HandleAllocator::new();
    let handle = textures.allocate(MyTexture::new());

    // Time tracking
    let mut time = Time::new();
    time.update();
    println!("Delta: {}ms", time.delta_secs() * 1000.0);
}
```

## Architecture

```
sable/
├── sable-core        # ✅ Math, handles, colors, time utilities
├── sable-platform    # ⏳ Windowing, input
├── sable-gpu         # ⏳ Vulkan abstraction
├── sable-metal       # ⏳ Metal backend (macOS/iOS)
├── sable-dx12        # ⏳ DirectX 12 backend (Windows)
├── sable-render      # ⏳ High-level rendering (backend-agnostic)
├── sable-assets      # ⏳ Asset loading, hot-reload
├── sable-scene       # ⏳ ECS, transforms, spatial structures
├── sable-audio       # ⏳ Audio playback, spatial sound
├── sable-physics     # ⏳ Collision, rigid bodies
├── sable-puppet      # ⏳ Live2D-style character animation
├── sable-script      # ⏳ Scripting integration
├── sable-editor      # ⏳ Visual development editor
├── sable-macros      # ⏳ Proc macros for DX
└── sable-app         # ⏳ Application framework
```

## What's Implemented

### sable-core ✅

| Module | Features |
|--------|----------|
| **Math** | Vec2, Vec3, Vec4, Mat3, Mat4, Quat with full operator support |
| **Transforms** | Rotation, scale, translation matrices; perspective/orthographic projection |
| **Quaternions** | Axis-angle, euler angles, slerp/nlerp interpolation |
| **Handles** | Generational indices for safe resource management |
| **Colors** | sRGB and linear color spaces with gamma-correct conversions |
| **Time** | Frame timing, fixed timestep for physics, stopwatch |

**Test Coverage:** 170 unit tests

## Status

🚧 **Early Development** — Foundation complete, rendering in progress.

See [TODO.md](TODO.md) for the full development roadmap.

## Getting Started

### Prerequisites

- Rust 2024 edition (nightly or latest stable)
- Vulkan SDK (for Vulkan backend)
- Xcode (for Metal backend on macOS)
- Windows SDK (for DX12 backend on Windows)

### Building

```bash
git clone https://github.com/PegasusHeavyIndustries/sable.git
cd sable
cargo build --workspace
```

### Running Tests

```bash
# All tests
cargo test --workspace

# Specific crate
cargo test -p sable-core
```

### Running Examples

```bash
# Basic triangle (coming soon)
cargo run --example hello_triangle

# 2D sprites (coming soon)
cargo run --example sprite_batch

# Puppet animation (coming soon)
cargo run --example puppet_basic
```

## Development Setup

```bash
# Install development tools
cargo install cargo-commitlint

# Run tests (also installs pre-commit hooks via cargo-husky)
cargo test --workspace

# Check formatting and lints
cargo fmt --all --check
cargo clippy --workspace -- -D warnings

# Build documentation
cargo doc --workspace --no-deps --open
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.

## Roadmap

| Milestone | Description | Status |
|-----------|-------------|--------|
| v0.1 | Foundation (math, handles, time) ||
| v0.2 | Platform & Vulkan (window, device, swapchain) | 🚧 |
| v0.2.5 | Metal backend ||
| v0.2.6 | DirectX 12 backend ||
| v0.3 | Basic rendering (meshes, textures, camera) ||
| v0.4 | 2D support (sprites, text) ||
| v0.5 | Production rendering (PBR, shadows) ||
| v0.6 | ECS and scenes ||
| v0.7 | Audio and physics ||
| v0.8 | Puppet system ||
| v0.9 | Scripting ||
| v0.10 | Editor ||
| v1.0 | Stable release ||

## Documentation

- [Development Roadmap]TODO.md
- [Contributing Guide]CONTRIBUTING.md
- [Changelog]CHANGELOG.md
- API Documentation: `cargo doc --workspace --open`

## License

Sable Engine is proprietary software. See [LICENSE](LICENSE) for full terms.

### Summary

| Team Size | License Terms |
|-----------|---------------|
| **< 5 people** | ✅ Free to use |
| **≥ 5 people** | 10% revenue share on sold copies |

- Free for indie developers and small teams
- Attribution required: "Built with Sable Engine © Pegasus Heavy Industries LLC"
- Cannot redistribute the engine separately
- Cannot use to build a competing game engine

For licensing inquiries: licensing@pegasusheavyindustries.com

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting PRs.

By contributing, you agree that your contributions will be licensed under the same proprietary license as the project.

---

**Sable** is developed by [Pegasus Heavy Industries LLC](https://github.com/PegasusHeavyIndustries).