Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another reorg #7

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions .github/workflows/cargo.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cargo
name: Build

on:
push:
Expand Down Expand Up @@ -64,35 +64,3 @@ jobs:
with:
name: doc
path: target/doc

# deploy:
# if: github.ref == 'refs/heads/main'
# needs: doc
# # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# permissions:
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source
# # Deploy to the github-pages environment
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: actions/download-artifact@v4
# with:
# name: doc
# path: ${{ github.workspace }}

# - name: Upload Pages artifact
# uses: actions/upload-pages-artifact@v3
# with:
# path: target/doc

# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
# if: github.event_name != 'pull_request'
66 changes: 66 additions & 0 deletions .github/workflows/extras.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Extras

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
RUST_LOG: info

jobs:

book:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v2

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.10'

- run: mdbook build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book

# deploy:
# if: github.ref == 'refs/heads/main'
# needs: doc
# # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# permissions:
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source
# # Deploy to the github-pages environment
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - uses: actions/download-artifact@v4
# with:
# name: doc
# path: ${{ github.workspace }}

# - name: Upload Pages artifact
# uses: actions/upload-pages-artifact@v3
# with:
# path: target/doc

# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
# if: github.event_name != 'pull_request'
110 changes: 49 additions & 61 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,73 +1,64 @@
[package]
name = "yahs"
description = "Yet Another HAB Simulator"
authors = ["Philip Linden <[email protected]>"]
version = "0.4.0"
edition = "2021"
authors = ["Philip Linden <[email protected]>"]
readme = "README.md"
license-file = "LICENSE"
license = "MIT or Apache-2.0"
edition = "2021"

default-run = "yahs"

# When importing this crate as a dependency, use the simulator library as "yahs"
[lib]
name = "yahs"
path = "src/simulator/src/lib.rs"

# When running this project as a CLI, use the CLI binary as "yahs"
[[bin]]
name = "yahs"
path = "src/main.rs"
path = "src/cli/src/main.rs"

# These are the dependencies when building the CLI from the project root
[dependencies]
# Simulator dependencies
yahs-simulator = { path = "src/simulator" }
bevy = { workspace = true }
avian3d = { workspace = true }
bevy-trait-query = { workspace = true }

# CLI dependencies
yahs-cli = { path = "src/cli" }
bevy_ratatui = "0.7.0"
ratatui = "0.29"
color-eyre = "0.6.3"
crossterm = "0.28.1"

[features]
default = [
# Default to a native dev build.
"dev_native",
"render",
]
dev = [
# Improve compile times for dev builds by linking Bevy as a dynamic
# library.
"bevy/dynamic_linking",
"bevy/bevy_dev_tools",
]
dev_native = [
"dev",
# Enable system information plugin for native dev builds.
"bevy/sysinfo_plugin",
]
headless = [
# Exclude rendering features
# This feature does not include the "render" feature
# Thus, rendering-related dependencies are disabled
]
render = [
# Enable features needed for visuals, windowed operation, and UIs.
"bevy/bevy_asset",
"bevy/bevy_color",
"bevy/bevy_core_pipeline",
"bevy/bevy_gizmos",
"bevy/ktx2",
"bevy/bevy_mesh_picking_backend",
"bevy/bevy_pbr",
"bevy/bevy_render",
"bevy/bevy_picking",
"bevy/bevy_text",
"bevy/bevy_ui",
"bevy/bevy_ui_picking_backend",
"bevy/bevy_window",
"bevy/bevy_winit",
"bevy/default_font",
"bevy/tonemapping_luts",
"bevy/png",
"bevy/webgl2",
]
inspect = [
"default",
"bevy-inspector-egui",
default = ["dev"]
dev = ["yahs-cli/dev", "yahs-simulator/dev"]

[workspace.package]
authors = ["Philip Linden <[email protected]>"]
edition = "2021"
license = "MIT or Apache-2.0"

[workspace]
resolver = "2" # Important for Bevy
members = [
"src/simulator",
"src/cli",
"src/ui"
]

[dependencies]
bevy = { version = "0.15.0", default-features = false, features = [
"bevy_asset",
"bevy_state",
"multi_threaded",
[workspace.dependencies]
# Shared dependencies with fixed versions
bevy = { version = "0.15.0", default-features = false, features = [
"bevy_state", "multi_threaded"
] }
avian3d = { git = "https://github.com/Jondolf/avian.git", branch = "main", features = ["debug-plugin"] }
bevy-trait-query = { git = "https://github.com/JoJoJet/bevy-trait-query.git", branch = "bevy-0.15-rc" }
bevy-inspector-egui = { version = "0.28", optional = true, features = ["highlight_changes"] }
avian3d = { git = "https://github.com/Jondolf/avian.git", branch = "main" }
bevy-trait-query = "0.7.0"

# -----------------------------------------------------------------------------
# Some Bevy optimizations
# -----------------------------------------------------------------------------
Expand All @@ -83,7 +74,6 @@ too_many_arguments = "allow"
# Queries that access many components may trigger this lint.
type_complexity = "allow"


# Compile with Performance Optimizations:
# https://bevyengine.org/learn/quick-start/getting-started/setup/#compile-with-performance-optimizations

Expand All @@ -94,6 +84,7 @@ opt-level = 1
# Enable a large amount of optimization in the dev profile for dependencies.
[profile.dev.package."*"]
opt-level = 3
debug = false

# The default profile is optimized for Wasm builds because that's what [Trunk
# reads](https://github.com/trunk-rs/trunk/issues/605). Optimize for size in the
Expand All @@ -102,9 +93,6 @@ opt-level = 3
# Compile the entire crate as one unit. Slows compile times, marginal
# improvements.
codegen-units = 1
# Do a second optimization pass over the entire program, including
# dependencies. Slows compile times, marginal improvements.
lto = "thin"
# Optimize with size in mind (also try "z", sometimes it is better).
# Slightly slows compile times, great improvements to file size and runtime
# performance.
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,46 @@ A high altitude balloon flight simulator built in

[devlog](docs/devlog.md)

## Usage

### As a library

Add `yahs` to your `Cargo.toml`:

```toml
[dependencies]
yahs = "0.4.0"
```

Then, add the `SimulatorPlugins` to your Bevy app:

```rust
use yahs::prelude::SimulatorPlugins;

fn main() {
App::new().add_plugins(SimulatorPlugins);
}
```

Then you can use all of the components and systems from the
[`yahs-simulator`](./src/simulator/README.md) crate.


### As an application

Running this package as a standalone application compiles all of the crates
and runs the CLI by default:

```bash
cargo run
```

Force the standalone application to run the GUI instead of the CLI:

```bash
cargo run --bin yahs-ui
```

## License

Except where noted (below and/or in individual files), all code in this
Expand Down
28 changes: 28 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[book]
authors = ["Philip Linden"]
language = "en"
multilingual = false
title = "yahs documentation"
src = "docs"

[build]
build-dir = "docs/book"
create-missing = false

[output.html]
mathjax-support = true
default-theme = "ayu"
preferred-dark-theme = "ayu"
smart-punctuation = true
# no-section-label = true
git-repository-url = "https://github.com/philiplinden/yahs"
git-repository-icon = "fa-github"
edit-url-template = "https://github.com/philiplinden/yahs/edit/main/docs/{path}"

[output.html.print]
enable = true # include support for printable output
page-break = true # insert page-break after each chapter

[output.html.fold]
enable = true # whether or not to enable section folding
level = 1 # the depth to start folding
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
11 changes: 11 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Introduction](index.md)

---

- [yahs-sim](crates/yahs-sim/README.md)
- [yahs-ui](crates/yahs-ui/README.md)
- [yahs-cli](crates/yahs-cli/README.md)

---

[Devlog](devlog.md)
9 changes: 8 additions & 1 deletion docs/devlog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# development log

## 2024-12-15

- Added [mdbook](https://github.com/rust-lang/mdBook) to the project.
- Added a CLI to the project so I can run things from the terminal without
getting caught up in the graphics.
- Organized the project into separate crates for the simulator, UI, and CLI.

## 2024-11-30

One last check for third party crates to see if they've officially updated to
Expand Down Expand Up @@ -36,7 +43,7 @@ Things I added:
- [x] Lighting based on Bevy's example.
- [x] Camera controller based on Bevy's `camera_controller` example.
- [x] Observer/trigger-based debug UI toggles. Only some of them are working.
- [x] Added targeting controls to the camera.
- [x] Added targeting controls to the camera. Could be better.

I spent a few hours trying to get the skybox working but I couldn't get it to
load.
Expand Down
18 changes: 18 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# yet another HAB simulator

This is a high altitude balloon simulator built in
[Bevy](https://bevyengine.org/). The goal is to simulate the flight of a HAB
(High Altitude Balloon) and to provide a software-in-the-loop platform for
testing out various physics and engineering concepts with a realistic
simulation.

This project is split into three parts:

- [yahs-sim](https://github.com/philiplinden/yahs-sim) is the main simulation
crate. It is a Bevy plugin that can be added to any Bevy project.
- [yahs-ui](https://github.com/philiplinden/yahs-ui) is a simple UI for the
simulation. It is not required but it is useful for visualizing the
simulation and for debugging.
- [yahs-cli](https://github.com/philiplinden/yahs-cli) is a command line tool
for running the simulation. It is useful for testing out the simulation
without having to deal with the UI.
Loading
Loading