Skip to content

dimforge/wgmath.rs

Repository files navigation

Website

This website is built using Docusaurus, a modern static website generator.

Installation

$ yarn

Build

$ yarn build

This command generates static content into the build directory and can be served using any static contents hosting service.

$ yarn start

This command builds and starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

WASM loading

Uncompressed, the .wasm file from wgsparkl2d demo weighs ~40 MB ; after wasm-opt, it's down to ~25MB.

We can go further by serving a compressed wasm file: using brotli reduces the size to ~5.6MB 🎉.

Now serving compressed wasm is not totally trivial, so our current setup is detailed below:

Manual steps:

  • compress .wasm with brotli
  • rename .wasm.br to .wasm (so we can keep javascript glue code generated by wasm-bindgen)

Automatic steps:

  • .htaccess tells apache to consider .wasm files as encoding br and content type application/wasm.
  • browser will be able to read correctly the brotlified wasm and run it 🎉.

To test locally:

  • You can use apache locally to approach the server environment.
  • Rewrite rules will get in the way, you can remove them temporarily.
  • If you use a subfolder of your apache's www ; website will complain about docusaurus' baseUrl, which you can update, but it's not relevant to test wasm files.
  • Local apache doesn't allow .htaccess by default ; you can enable it within your apached2.conf with AllowOverride All for your directory.

Your browser might not be compatible, at the time of writing, chrome is most likely to support the demos, and the following flags might be relevant:

  • chrome://flags/#enable-unsafe-webgpu
  • chrome://flags/#enable-vulkan

About

Website for the wgmath ecosystem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages