-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support for wasm32-unknown-unknown target (WebGL) #149
base: master
Are you sure you want to change the base?
Conversation
ee8482c
to
b14582b
Compare
Also _pad: vec2 in shader seems unused, I renamed it to apad because shader won’t compile |
Please rebase! |
c36b8c4
to
d646cca
Compare
Everything looks working, but seems render is not fit for webgl, have this issue:
|
Please file this separately, I'll address it shortly. |
9692635
to
ff6c3ed
Compare
826999a
to
0416e4c
Compare
0416e4c
to
f4b541c
Compare
2b9a96b
to
3a79885
Compare
c340ea2
to
853515e
Compare
6bc3562
to
de2b7c8
Compare
Please comment what to fix, I will update README.md soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work!
@@ -1,9 +1,9 @@ | |||
name: Check | |||
on: | |||
push: | |||
branches: [master] | |||
branches: [master, vange-rs-web] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we are already in vange-rs
repo, perhaps the branch could just be called web
?
@@ -14,7 +14,9 @@ jobs: | |||
runs-on: ${{ matrix.os }} | |||
steps: | |||
- uses: actions/checkout@v2 | |||
- run: rustup target add wasm32-unknown-unknown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a note to tell what we are doing to whoever is reading the log
README.md
Outdated
|
||
**Resources** | ||
|
||
To build game **you must** put resources of original game in `res_linux/data` folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this res_linux
specifically and not some web/resources
for example?
use wasm_bindgen::prelude::*; | ||
use wasm_bindgen::JsCast; | ||
|
||
extern crate console_error_panic_hook; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to declare extern crates like this any more in Rust
create_file!("data/wrlds.dat", get_bundled_file!()); | ||
|
||
// the chain | ||
create_file!("data/thechain/threall/world.ini", get_bundled_file!()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably do it in build.rs
, for multiple reasons. First, we could drive this by data or environment instead of a cargo feature, which means there is less enabling/disabling of code paths going on.
And secondly, most importantly, we could just walk the directory tree and pick up all the files we need, instead of enumerating every single filename/path.
print("\tcreate_file(\"" + path + "\", include_bytes!(\"../" + path + "\"));"); | ||
|
||
print("\n\t// vangers resouces") | ||
for root, subdirs, files in os.walk("res_linux"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, yeah, a build.rs script would be much better than a python script :)
let window = web_sys::window().expect("should have a window in this context"); | ||
|
||
{ | ||
let mappings: HashMap<String, Key> = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the key should be &'static str
instead of String
</script> | ||
|
||
<script> | ||
const filesToFetch = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have this queried instead of hard-coded, but we can do it as a follow-up
const generateConfig = (level) => ` | ||
( | ||
data_path: "data", | ||
game: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be feasible to read the config from the file? e.g. in build script.
de2b7c8
to
9da4648
Compare
I tried to update wgpu to 0.11.0 (in order to support WebGL in future). I fixed some initialization code and now it compiles but render black screen, can you please point me what I did wrong.
Platform: linux
Renderer: vulkan