|
|
|
@ -1,116 +1,25 @@ |
|
|
|
<div align="center"> |
|
|
|
# Easel3D |
|
|
|
|
|
|
|
<h1><code>wasm-pack-template</code></h1> |
|
|
|
|
|
|
|
<strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong> |
|
|
|
|
|
|
|
<p> |
|
|
|
<a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a> |
|
|
|
</p> |
|
|
|
|
|
|
|
<h3> |
|
|
|
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a> |
|
|
|
<span> | </span> |
|
|
|
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a> |
|
|
|
</h3> |
|
|
|
|
|
|
|
<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub> |
|
|
|
</div> |
|
|
|
|
|
|
|
## About |
|
|
|
|
|
|
|
[**📚 Read this template tutorial! 📚**][template-docs] |
|
|
|
|
|
|
|
This template is designed for compiling Rust libraries into WebAssembly and |
|
|
|
publishing the resulting package to NPM. |
|
|
|
|
|
|
|
Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other |
|
|
|
templates and usages of `wasm-pack`. |
|
|
|
|
|
|
|
[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html |
|
|
|
[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html |
|
|
|
|
|
|
|
## 🚴 Usage |
|
|
|
|
|
|
|
### 🐑 Use `cargo generate` to Clone this Template |
|
|
|
|
|
|
|
[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate) |
|
|
|
|
|
|
|
``` |
|
|
|
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project |
|
|
|
cd my-project |
|
|
|
``` |
|
|
|
|
|
|
|
### 🛠️ Build with `wasm-pack build` |
|
|
|
|
|
|
|
``` |
|
|
|
wasm-pack build |
|
|
|
``` |
|
|
|
|
|
|
|
### 🔬 Test in Headless Browsers with `wasm-pack test` |
|
|
|
|
|
|
|
``` |
|
|
|
wasm-pack test --headless --firefox |
|
|
|
``` |
|
|
|
|
|
|
|
### 🎁 Publish to NPM with `wasm-pack publish` |
|
|
|
|
|
|
|
``` |
|
|
|
wasm-pack publish |
|
|
|
``` |
|
|
|
|
|
|
|
## 🔋 Batteries Included |
|
|
|
|
|
|
|
* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating |
|
|
|
between WebAssembly and JavaScript. |
|
|
|
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) |
|
|
|
for logging panic messages to the developer console. |
|
|
|
* [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized |
|
|
|
for small code size. |
|
|
|
# Rust playground |
|
|
|
|
|
|
|
Things I have recently done while learning the Rust programming language. |
|
|
|
A rust library for manipulating and display of 3D objects on a canvas. |
|
|
|
|
|
|
|
## Synopsis |
|
|
|
|
|
|
|
Change in one of the toplevel subdirectories and try `cargo build` or |
|
|
|
`cargo run`. Maybe not everything is working oob. Feel free to fix whatever |
|
|
|
you want. |
|
|
|
`cargo build` |
|
|
|
|
|
|
|
## Description |
|
|
|
|
|
|
|
Various small examples I have tried while learning rust. The biggest and |
|
|
|
currently most active project is **fractional** which started as an |
|
|
|
implamentation of a rational number data type and then switched to a 3D |
|
|
|
math playground visualizing using **XCB** (in future it might also use |
|
|
|
a **HTML5 Canvas** for drawing as WebAssembly application. |
|
|
|
Using fractions with 3D math has several drawbacks: |
|
|
|
|
|
|
|
1. A huge part of 3D math is non rational, like sin, cos, tan and sqrt. |
|
|
|
2. The numerator and denominator tend to become very huge while nearing to non |
|
|
|
rational numbers and reduction is difficult and time consuming. |
|
|
|
3. Because of 2 it is way slower than the floating point calculation (at least |
|
|
|
with a decent coprocessor). |
|
|
|
|
|
|
|
Anyway, implementing the vector math stuff for both fractions and floating |
|
|
|
point was a nice playground for generics and traits. In future I might add |
|
|
|
another data type which implements the math as done by David Braben for the |
|
|
|
elite computer game. |
|
|
|
A 3D math playground visualizing on a canvas trait which the user needs to |
|
|
|
implement e.g. using **XCB** or a **HTML5 Canvas** for drawing as WebAssembly |
|
|
|
application. (Both exists in separate projects.) |
|
|
|
|
|
|
|
## Requirements |
|
|
|
|
|
|
|
### Always |
|
|
|
|
|
|
|
- A recent version of the Rust programming language as well as tooling. |
|
|
|
Currently I use Rust 1.39.0. |
|
|
|
|
|
|
|
### For fractional |
|
|
|
|
|
|
|
- A running X Server with **XCB** and **X11-SHM** extentions |
|
|
|
|
|
|
|
## Dependencies |
|
|
|
|
|
|
|
... |
|
|
|
- lazy_static v1.4.0 |
|
|
|
|
|
|
|
## Contributing |
|
|
|
|
|
|
|
|