Bindings for the three.js graphics library

I am working on a WebAssembly crate that provides bindings to the three.js graphics library. I'm still very new to Rust and have definitely jumped in the deep end on this one, but nonetheless I have made enough process on this project that I have a minimal working example that I would like to get some feedback on.

At the moment, I haven't published anything on crates.io, so you will need to clone the following repositories from Github. The links and remainder of this post are in the replies since I can not post more than two links as a new user.

2 Likes

Repositories and build instructions

The testbench refers to the threejs-sys by specifying the depenency path attribute as ../threejs-sys so if both repositories have been cloned into the same folder, you should be able to build and run the testbench with:

wasm-pack build --target web
python -m http.server

and then open localhost on port 8000 in your web browser.

1 Like

Questions and concluding comments

In addition to any general feedback or ideas, I would really like answers to these two questions:

  1. At the moment, I am "linking" against three.module.js from three.js/build at dev · mrdoob/three.js · GitHub and including this file directly in my threejs-sys crate. Is this best practice for creating such a crate? Perhaps it is better practice to somehow "link" against the individual js classes in https://github.com/mrdoob/three.js/tree/dev/src/core
  2. For WebGLRenderer.domElement, I am returning a web_sys::HtmlElement, would it make more sense to return a web_sys::HtmlCanvasElement?
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.