Skip to content

Commit

Permalink
Move winit/wasm example to example directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Jan 10, 2024
1 parent 7bba362 commit 33da19c
Show file tree
Hide file tree
Showing 12 changed files with 3,000 additions and 171 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
/.idea
/sg2d-wgpu/tests/output/
.DS_Store
.DS_Store
/sg2d-wgpu/examples/wgpu-winit/pkg/
/sg2d-wgpu/examples/wgpu-winit/target/
25 changes: 0 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"sg2d-wgpu",
"sg2d-vega-test-data",
]

resolver = "2"

[workspace.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ cargo run
## Build wasm
To build the example above to WASM + WebGL2, run the following:
```
cd sg2d-wgpu
cd sg2d-wgpu/examples/wgpu-winit
wasm-pack build --target web
```

Then open `vega-wgpu-renderer/index.html` in a web browser.
Then open `sg2d-wgpu/examples/wgpu-winit/index.html` in a web browser.

## Export PNG
The `PngCanvas` struct can be used to convert a scene graph to a PNG image headlessly. See the tests in
Expand Down
21 changes: 6 additions & 15 deletions sg2d-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]

[[example]]
name = "wgpu-winit"
path = "examples/wgpu-winit"
crate-type = ["cdylib", "rlib"]

[dependencies]
sg2d = { path = "../sg2d" }

Expand All @@ -24,22 +29,8 @@ futures-intrusive = "^0.5"
glyphon = { git = "https://github.com/grovesNL/glyphon.git", rev="941309aed230d7110bfec0d4af502ecb4648cf90" }
lyon = { workspace = true }

# Only used for lib.rs example. Move this to example
[dev-dependencies]
sg2d-vega = { path = "../sg2d-vega" }
serde_json = { version = "1.0.111" }

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
console_log = "1.0"
wgpu = { version = "0.18", features = ["webgl"]}
wasm-bindgen = "=0.2.87"
wasm-bindgen-futures = "0.4.30"
web-sys = { version = "0.3.53", features = [
"Document",
"Window",
"Element",
]}

[dev-dependencies]
dssim = "3.2.4"
rstest = "0.18.2"
Loading

0 comments on commit 33da19c

Please sign in to comment.