Commit Graph

14 Commits

Author SHA1 Message Date
iceiix 08900fc6f7
www: remove npm package-lock.json for now (#556)
While the package lock is useful to consistently include the same
versions of each package, right now it causes too much noise with
dependabot, as new versions are released but with little or no impact on
this project because the web port is not yet usable (see #446 🕸️ Web
support)
2021-06-18 06:09:34 -07:00
iceiix 24b6d84414
Update web dependencies (#542)
* Bump elliptic to 6.5.4. Closes #520

* Bump y18n to 4.0.1. Closes #528

* Bump ssri to 6.0.2. Closes #531

* Bump url-parse to 1.5.1. Closes #536

* Bump lodash to 4.17.21. Closes #537
2021-05-23 12:11:35 -07:00
iceiix 56f9c0e908
www: bundle resources statically (#483) 2021-01-18 09:48:38 -08:00
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
iceiix 0471eb3a82 Use web-sys for web backend (#444)
A small step for #446 🕸️ Web support, use web-sys to interface to the web.
Previously, we would try to use glutin on the web, which is not supported;
now glutin is only used on native: fixes #171 could not find Context in platform_impl.

winit is still used on both, but the GL context is created with web-sys and glow
(on the web), and created with glutin and used with glow (on native). stdweb is
no longer used, being replaced by web-sys.

Substantial refactoring to allow reusing the code between web/native:

* settings: use VirtualKeyCode from winit, not reexported from glutin
* std_or_web: remove broken localstoragefs/stdweb, add File placeholder
* render: disable skin_thread on wasm since we don't have threads

* gl: use glow types in gl wrapper (integers in native, but Web*Key in web)
* gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't
* gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web
* gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper

* glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2

* shaders: add explicit float/int type conversions, required for WebGL
* shaders: specify mediump precision, required for WebGL
* shaders: specify fragment shader output locations for WebGL

* main: refactor handle_window_event to take a winit window, not glutin context
* main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this)
* main: use winit events in handle_window_event not reexported glutin events
* main: refactor game loop handling into tick_all()
* main: create winit window for WebGL, and use winit_window from glutin
* main: restore console_error_panic_hook,  mistakingly removed in (#260)
* main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web

* www: index.js: fix wasm import path
* www: npm update, npm audit fix
* www: update readme to link to status on #446 🕸️ Web support
2020-12-26 13:43:21 -08:00
dependabot[bot] 20af7667d9 build(deps): bump lodash from 4.17.15 to 4.17.19 in /www
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-10 12:11:20 -07:00
ice_iix 852624f68a www: npm audit fix, closes #300, closes #324 2020-06-20 11:58:36 -07:00
ice_iix a06928e6da www: npm audit fix to update deps, fixing GHSA-h9rv-jmmf-4pgx
https://github.com/advisories/GHSA-h9rv-jmmf-4pgx
https://github.com/iceiix/stevenarella/network/alert/www/package-lock.json/serialize-javascript/open
2020-02-02 09:08:46 -08:00
ice_iix 472208cc8c www: update README to remove wasm-pack; use cargo web start
wasm-pack is more broken, see https://github.com/iceiix/stevenarella/issues/171#issuecomment-581151711
cargo web start is still broken (#171) but less so
2020-02-02 09:07:51 -08:00
iceiix a020ed6f2c
Update to glutin 0.22.0-alpha5, remove wasm_stub (#260)
Update from glutin 0.21.x fork to glutin 0.22.0-alpha5 and corresponding
compatible version of winit. This removes our custom temporary wasm_stub
branches, back to mainline glutin and winit, and is a step towards WebAssembly
compatibility, most importantly merging the game loop and event loops as
required by winit _which now supports wasm_. Not yet functional on the web
because other web dependencies have to be added, see #171 and #34, but native
functionality is preserved.

* Update for 0.22 glutin API changes:

* Move game logic into event loop, run() replacing poll_events()

* Specify fullscreen Borderless mode

* Pass generic parameter of Event through handle_window_event
* hidpi_factor() replaces get_hidpi_factor()
* with_inner_size() replaces with_dimensions()
* No longer need to unwrap() LogicalSize
* set_cursor_grab/visible() replaces grab/hide_cursor()

* Fix modifiers deprecated warnings by destructuring only event fields we use, ignoring the rest with '..'

* Remove unnecessary mutability from events_loop

* Listen for ModifiersChanged event, fixing deprecated modifiers field

* Change to stdweb for web backend, replacing web-sys

* Pin to glutin =0.22.0-alpha5 and winit =0.20.0-alpha6
2020-01-05 17:56:32 -08:00
dependabot[bot] 095ae1f6ab Bump lodash from 4.17.11 to 4.17.15 in /www (#201)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-27 17:50:33 -07:00
ice_iix 2a3be38407 npm update www dependencies. Closes #182 2019-07-04 15:25:02 -07:00
iceiix 836ab9f126
wasm: Fix operation not supported on std::fs. Closes #115 (#166)
* Add new web-based std::fs replacement, localstoragefs:

https://github.com/iceiix/localstoragefs

* Add std_or_web to switch between std::fs (native) or localstoragefs (web)

* Update www readme for new missing glutin/winit links, opens issue #171
2019-05-29 08:21:56 -07:00
iceiix 2f2f35848a
Add support for compiling WebAssembly wasm32-unknown-unknown target (#92)
Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

https://github.com/aweinstock314/rust-clipboard/pull/62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: https://github.com/rustgd/collision-rs/issues/106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.com-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for https://github.com/Frommi/miniz_oxide/issues/42

* Update to official clipboard crate since https://github.com/aweinstock314/rust-clipboard/pull/62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

https://github.com/iceiix/glutin/pull/1

* Update winit dependency of glutin to git master

https://github.com/iceiix/winit/pull/2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

97797352b5
2019-03-03 08:32:36 -08:00