Files
openvistapro/README.md
2026-05-16 16:00:51 -04:00

104 lines
5.3 KiB
Markdown

# OpenVistaPro
OpenVistaPro is an early-stage, open-source Rust project to build a modern landscape generator inspired by classic VistaPro.
The goal is not to redistribute or reuse proprietary VistaPro code/assets. The local `reference/` directory is intentionally ignored by git and is used only for historical/product research.
## Current status
This repository currently contains:
- A Rust binary crate scaffold.
- A first-pass knowledgebase under `docs/knowledgebase/`.
- An implementation roadmap under `docs/plans/`.
- Legal and reference-material hygiene notes under `docs/legal/` and `docs/research/`.
- A clean-room terrain import boundary with project-owned `ovp-text` fixtures, a PNG heightmap script importer, an SRTM/HGT byte importer behind the `hgt` Cargo feature, and an ESRI ASCII Grid parser behind the `ascii-grid-import` feature.
## Development
```bash
cargo build
cargo test
cargo run -- info
cargo run -- scene export --output /tmp/openvistapro-default.ovp.toml
cargo run -- render --preset hill --width 256 --height 256 --output /tmp/openvistapro-hill.png
cargo run -- render --preset hill --scene /tmp/openvistapro-default.ovp.toml --width 256 --height 256 --output /tmp/openvistapro-hill-from-scene.png
cargo run -- render --preset hill --camera-demo --width 256 --height 192 --output /tmp/openvistapro-perspective.png
cargo run --features app --bin openvistapro_app
```
The optional app shell is gated behind the `app` feature so default CLI builds stay GPU-free.
It opens an `eframe`/`egui` window titled `OpenVistaPro` with scene controls and a CPU-rendered terrain preview.
Importer status:
- `heightmap`: script execution can import grayscale PNG heightmaps with `import heightmap "path.png"` and map brightness to elevation.
- `ovp-text`: project-owned plain-text heightfield fixture format used for import-boundary tests.
- `hgt`: enabled by the optional `hgt` Cargo feature; parses SRTM HGT payloads as square grids of big-endian signed 16-bit metre samples. The implementation and tests use open specifications and synthetic/tiny fixtures only.
- `esri-ascii-grid`: enabled by the optional `ascii-grid-import` Cargo feature; parses open ESRI ASCII Grid text with synthetic/project-owned fixtures only.
- `geotiff`: enabled by the optional `import-geotiff` Cargo feature; parses single-band GeoTIFF elevation tiles in memory via the pure-Rust `geotiff-reader` crate (no GDAL, no native dependency). It supports a deliberately narrow subset — a single-band raster decoded as `f32` — and is reported by `openvistapro info` only when the feature is built.
All importer tests use tiny synthetic, project-owned fixture data: HGT uses inline synthetic byte arrays, ESRI ASCII Grid uses tiny project-owned text fixtures, and the GeoTIFF tests generate a tiny single-band tile in memory rather than reading committed binaries or real geodata.
To verify the importer feature surface:
```bash
cargo test import
cargo test hgt
cargo test hgt --features hgt
cargo test ascii_grid --features ascii-grid-import
cargo run --features hgt --bin openvistapro -- info
cargo run --features ascii-grid-import --bin openvistapro -- info
cargo test --no-default-features
cargo test geotiff --features import-geotiff
cargo run --features import-geotiff --bin openvistapro -- info
cargo test --all-features
```
The default `render` mode writes a deterministic top-down elevation preview.
Passing `--camera-demo` switches to the current CPU perspective renderer spike:
a simple pinhole-camera raymarcher with bilinear height sampling, fixed step
size, sky gradient, and distance haze. It is intended as a readable reference
renderer for architecture validation, not a performance target or final visual
model.
Scene files use the project-owned `.ovp.toml` format. Version 1 stores a
top-level `schema = "openvistapro.scene"`, `version = 1`, and a serialized
`Scene` payload containing camera, light, water, tree-line, snow-line, and haze
settings. The format is intentionally human-readable while the data model is
still evolving.
## Script language (MVP)
OpenVistaPro includes a small, line-oriented scripting language for driving
terrain and render jobs from a plain-text file (`src/script.rs`). The grammar
is **clean-room and project-owned**: it is **not VistaPro-compatible** and
deliberately does not mirror the legacy VistaPro scripting syntax.
Each line is a blank line, a `#` comment (also usable as a trailing comment),
or one command:
```text
use preset hill # `hill` or `plane`
set thresholds water=0.18 tree=0.42 snow=0.77
import heightmap "data/demo-height.png" # optional grayscale PNG terrain input
render output "out/demo.png"
```
Run the checked-in demo script with:
```bash
cargo run --bin openvistapro -- script run --input examples/demo.ovps
```
Script paths are resolved relative to the script file. `use preset` and
`import heightmap` select the active terrain, `set thresholds` updates scene
bands, and execution writes each `render output` to a deterministic PNG.
## Project principles
- Clean-room implementation: do not decompile, copy, or translate proprietary binaries.
- Use open data formats and openly licensed datasets.
- Preserve the spirit/workflow of VistaPro while designing a modern UX and renderer.
- Start with a small, testable terrain engine before building advanced rendering or UI.