stevenarella/www
iceiix 22f6c83d59
WebGL fixes after disabling threaded chunk builder (#451)
At this point, the UI renders in the browser through WebGL, with no GL errors.
Progress towards #446 🕸️ Web support

* main: enable render loop on wasm, disable events_loop on wasm for now
Allow for testing rendering on WebGL

* chunk_builder: disable on wasm due to no threads on wasm
Chunks will not be correctly rendered, but other parts of the program now can be tested instead of crashing in std::thread

* chunk_frag: glBindFragDataLocation is only on native, WebGL 2 uses in-shader specification layout(location=), which works on native in OpenGL 4.1 but we're on OpenGL 3.2 - see https://www.khronos.org/opengl/wiki/Fragment_Shader#Output_buffers

* std_or_web: always fail File::open() to avoid servers.json empty string JSON parse failing

* www: update installation instructions

* render: fix apparent TEXTURE_MAX_LEVEL -> TEXTURE_MAG_FILTER typo

* render: correct type for internalFormat DEPTH_COMPONENT24
Valid combinations of format, type, and internalFormat are listed at https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf#page=124&zoom=100,168,206. We had UNSIGNED_BYTE for DEPTH_COMPONENT24, but only UNSIGNED_INT is a valid type for this internal format.

Fixes texImage: Mismatched internalFormat and format/type: 0x81a6 and 0x1902/0x1401
and fixes the subsequent GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error.

* render: gl::MULTISAMPLE (0x809d) is not available on WebGL
Fixes WebGL warning: enabled: cap: Invalid enum value <enum 0x809d> 0.bootstrap.js line 11 > eval:851:21

* gl: replace set_float_multi_raw with a safer set_float_multi
Removes use of passing raw pointers in set_float_multi_raw parameters
Instead, casts raw pointers to flatten, similar to set_matrix_multi
Fixes uniform setter: (uniform colorMul[0]) values length (1) must be a positive integer multiple of size of <enum 0x8b52>.

* render: model: send BYTE to id attrib, fixes type mismatch
Fixes drawElementsInstanced: Vertex attrib 0 requires data of type INT, but is being supplied with type UINT
2020-12-31 14:35:30 -08:00
..
.gitignore Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00
README.md WebGL fixes after disabling threaded chunk builder (#451) 2020-12-31 14:35:30 -08:00
bootstrap.js Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00
index.html Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00
index.js Use web-sys for web backend (#444) 2020-12-26 13:43:21 -08:00
package-lock.json Use web-sys for web backend (#444) 2020-12-26 13:43:21 -08:00
package.json Use web-sys for web backend (#444) 2020-12-26 13:43:21 -08:00
webpack.config.js Add support for compiling WebAssembly wasm32-unknown-unknown target (#92) 2019-03-03 08:32:36 -08:00

README.md

stevenarella-web

Web app for running Stevenarella as WebAssembly

Status: very incomplete. It currently compiles but does not run, due to required modifications to adapt to the web, for progress see: 🕸️ Web support

Building

To build for wasm32-unknown-unknown, run in the top-level directory (not www):

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli
cargo install wasm-pack
wasm-pack build --dev

or:

cargo web start --target wasm32-unknown-unknown

Running

After building the Rust app, run the NodeJS web server as follows:

cd pkg
sudo npm link
cd ..
cd www
npm link stevenarella
npm install
npm start
open http://localhost:8080/

Credits

Based on rustwasm/create-wasm-app:

An npm init template for kick starting a project that uses NPM packages containing Rust-generated WebAssembly and bundles them with Webpack.