Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jomala committed Jan 5, 2021
1 parent 173cd73 commit c0128f9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description = "A skybox from an image for bevyengine.org"
version = "0.1.0"
authors = ["Jonathan Lawn <Jonathan.M.Lawn@gmail.com>"]
license = "MIT OR Apache-2.0"
publish = false
readme = "README.md"
edition = "2018"

Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ rectangle and filling most of its width and height.

## Usage

See `examples\board_flyover.rs` for an example of its usage.
The usage is documented in the module comment at the top of `src/lib.rs`.

## Build
To demonstrate this, `examples\board_flyover.rs` puts a skybox around a flat "board". Key/mouse camera movement is provided by `bevy_fly_camera`.

Build using `nightly` toolchain, e.g.
![Board Flyover example](docs/board_flyover.png)

```
cargo +nightly run --release --example board_flyover
```
Skybox images come from the following sources.

* **sky1.png** - https://www.cleanpng.com/png-skybox-cube-mapping-texture-mapping-terragen-textu-1384141
* **sky2.png** - https://www.cleanpng.com/png-skybox-texture-mapping-cube-mapping-sky-cloud-920475 (flipped)

## Image processing

Many skybox are available as net images. `bevy_skybox` assumes that the image is a specific net
of a cube.

The assumptions about the image are listed in `src/image.rs`.
The assumptions about the image are listed in `src/image.rs`, but the image is measured like this.

## Example
![Measuring the cube net](docs/measuring_the_net.png)

The example puts a skybox around a flat "board". Key/mouse camera movement is provided by `bevy_fly_camera`.

![Board Flyover example](docs/board_flyover.png)
## Build

Skybox images come from the following sources.
Build using `nightly` toolchain, e.g.

* **sky1.png** - https://www.cleanpng.com/png-skybox-cube-mapping-texture-mapping-terragen-textu-1384141
* **sky2.png** - https://www.cleanpng.com/png-skybox-texture-mapping-cube-mapping-sky-cloud-920475 (flipped)
```
cargo +nightly run --release --example board_flyover
```

## Futures

Expand All @@ -45,3 +45,5 @@ So far, this is suitable for demos, not production.
and the XZ plane may not be horizontal for all.
* The `SkyboxBox` should have a different draw distance to the rest of the scene.
* Multiple `SkyboxCamera` objects should be handled better, at least as an error.
* There may be a better interchange response structure from the `image` module than
`Mesh` that is more convenient for anyone using a pre-aligned skybox model.
1 change: 1 addition & 0 deletions docs/measuring_the_net.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2021-01-05T21:26:00.595Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" etag="WeKiYDAceL4Xqth-_ggn" version="14.1.8" type="device"><diagram id="5ZT5mJflV6rGyMDt6E_q" name="Page-1">7Zxbc9o4FMc/DY/NWJIv+LEkTdvpdLezmZ12Hx0swBODqRAB9tOvHMu3IwM2+LYxTB7QQZbtv345OudYMCL3y/1n5qwX3wOX+iOsufsReRhhjHSMR+Gf5h4ii2VKw5x5ruyUGp68f6k0atK69Vy6yXXkQeBzb503ToPVik55zuYwFuzy3WaBnz/r2plTxfA0dXzV+tNz+SKyjg0ttX+h3nwRnxlp8pOlE3eWhs3CcYNdxkQ+jcg9CwIevVvu76kfihfrEh33eOTT5MIYXfEyB/y9+4M8878+v/z88/e318Xrw/L3ywc5yqvjb+UNy4vlh1iB3cLj9GntTMP2TszyiEwWfOmLFhJvnc060n3m7ak41USOSBmn+6OXihIBBDk0WFLODqKLPADHIkpo8Fi2d5kpkKZFRv3Y5shJnycjp7qIN1KaCjLhfso07plMpJcyEbNnMum9lEnXeyaT0UuZFJq0jmUy/xcyJe2uZLIUmVxFJ3G7PC/NhrPghd4HfsCEZRWsRM/JzPN9YHJ8b74SzamQhwr7JBTPE2HER/nB0nPd8DSTorlgwXblhso/aA2pb6vqowL1cVPqj4ekvk56pr49JPWJbZz1PK2qH59smPLruGv51RxnQPIXRXHtyq/mTkOSvyA6bFd+Ndl4z/LDuAd1Lb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GSE7mRLAOJ7zxTf+JMX+Zvu9PAjrPLQenIN1waBSu+obYqo2imP/cVdU9/NI18+g8=</diagram></mxfile>
Binary file added docs/measuring_the_net.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ fn move_skybox(
mut skybox_query: Query<(&mut Transform, &SkyboxBox)>,
camera_query: Query<(&PerspectiveProjection, &Transform, &SkyboxCamera)>,
) {
if let Some((mut pbr_trans, _)) = skybox_query.iter_mut().next() {
for (cam_proj, cam_trans, _) in camera_query.iter() {
if let Some((cam_proj, cam_trans, _)) = camera_query.iter().next() {
for (mut pbr_trans, _) in skybox_query.iter_mut() {
*pbr_trans = Transform {
translation: cam_trans.translation,
rotation: Quat::identity(),
Expand All @@ -72,6 +72,9 @@ fn move_skybox(
pub struct SkyboxCamera;

/// The `SkyboxBox` tag attached to the skybox mesh entity.
///
/// This can also be used to tag any other `Transform` that you want to translate with
/// the `SkyboxCamera`, e.g. a light source.
pub struct SkyboxBox;

/// The `SkyboxPlugin` object acts as both the plugin and the resource providing the image name.
Expand Down

0 comments on commit c0128f9

Please sign in to comment.