Commit Graph

76 Commits

Author SHA1 Message Date
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
iceiix c099a68168
Use glutin to replace sdl2 (#35)
* Add glutin dependency

* Create a glutin window

* Use the glutin window, basics work

* Store DPI factor on game object, update on Resized

* Use physical size for rendering only. Fixes UI scaled too small

Fixes https://github.com/iceiix/steven/pull/35#issuecomment-442683373
See also https://github.com/iceiix/steven/issues/22

* Begin adding mouse input events

* Listen for DeviceEvents

* Call hover_at on mouse motion

* Listen for CursorMoved window event, hovering works

Glutin has separate WindowEvent::CursorMoved and
DeviceEvent::MouseMotion events, for absolute cursor and relative mouse
motion, respectively, instead of SDL's Event::MouseMotion for both.

* Use tuple pattern matching instead of nested if for MouseInput

* Implement left clicking

* Use grab_cursor() to capture the cursor

* Hide the cursor when grabbing

* Implement MouseWheel event

* Listen for keyboard input, escape key release

* Keyboard input: console toggling, glutin calls backquote 'grave'

* Implement fullscreen in glutin, updates https://github.com/iceiix/steven/pull/31

* Update settings for glutin VirtualKeyCode

* Keyboard controls (note: must clear conf.cfg to use correct bindings)

* Move DeviceEvent match arm up higher for clarity

* Remove SDL

* Pass physical dimensions to renderer tick so blit_framebuffer can use full size but the ui is still sized logically.

* Listen for DeviceEvent::Text

* Implement text input using ReceivedCharacter window event, works

https://github.com/iceiix/steven/pull/35#issuecomment-443247267

* Request specific version of OpenGL, version 3.2

* Request OpenGL 3.2 but fallback to OpenGL ES 2.0 if available (not tested)

* Set core profile and depth 24-bits, stencil 0-bits

* Allow changing vsync, but require restarting (until https://github.com/tomaka/glutin/issues/693)

* Clarify specific Rust version requirement

* Import glutin::* in handle_window_event() to avoid overly repetitive code

* Linux in VM fix: manually calculate delta in MouseMotion

For the third issue on https://github.com/iceiix/steven/pull/35#issuecomment-443084458
https://github.com/tomaka/glutin/issues/1084 MouseMotion event returns absolute instead of relative values, when running Linux in a VM

* Heuristic to detect absolute/relative MouseMotion from delta:(xrel, yrel); use a higher scaling factor

* Add clipboard pasting with clipboard crate instead of sdl2

https://github.com/iceiix/steven/pull/35#issuecomment-443307295
2018-11-30 11:35:35 -08:00
ice_iix 7d41bb838d Revert "Change multisampling count to 0, improved fix/workaround for AMD GPUs (#26)"
NUM_SAMPLES=0 or 1 breaks AMD Radeon R9 M295X on Windows 11, but 2 works.

This reverts commit 748911a91b.
2018-11-19 17:44:06 -08:00
iceiix 748911a91b
Change multisampling count to 0, improved fix/workaround for AMD GPUs (#26)
Part of fixing graphical rendering bugs: https://github.com/iceiix/steven/issues/25
Corrupted graphics on AMD video cards: https://github.com/Thinkofname/steven/issues/74

The previous workaround set NUM_SAMPLES to 2, but this added an extra texel fetch. Setting to 1 reproduces the 16px blue striped unexpected behavior. Setting to 0 samples avoids the extra fetch and the striping.

This is allowed per http://docs.gl/gl3/glTexImage2DMultisample:
> samples specifies the number of samples in the image and must be in the range zero to GL_MAX_SAMPLES - 1.
2018-11-18 16:18:16 -08:00
ice_iix 77cd4ecf35 Use field init shorthand, instead of x:x, just x,
https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html

find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \;
2018-11-04 13:43:30 -08:00
ice_iix 411e4f69a6 Remove unnecessary 'extern crate's in Rust 2018 edition, import macros
https://rust-lang-nursery.github.io/edition-guide/print.html#no-more-extern-crate
https://rust-lang-nursery.github.io/edition-guide/rust-2018/macros/macro-changes.html
https://github.com/iceiix/steven/pull/13#issuecomment-435702507
2018-11-04 12:39:23 -08:00
ice_iix a40cd43a2e Update to use crate:: for current crate, for Rust 2018 edition
From `cargo fix --edition`, see https://rust-lang-nursery.github.io/edition-guide/print.html#the-crate-keyword-refers-to-the-current-crate
2018-11-04 12:06:00 -08:00
ice_iix db02f9e790 Update try!() to new ? syntax for Rust 2018 edition
Not automatically updated, see https://users.rust-lang.org/t/why-does-cargo-fix-replace-try-with-r-try-instead-of/21972/3
There are other tools to replace it, btu this is what I used:
find src -name '*.rs' -exec perl -MRegexp::Common -0777 -pe'$bp=$RE{balanced}{-parens=>"()"}; s/try\!($bp)/substr($1, 1, length($1) - 2) . "?"/ges' -i {} \;
2018-11-04 11:48:51 -08:00
ice_iix f6a56f5b86 Use non-colliding variable name dynamic_texture instead of dyn (now a keyword) 2018-11-04 11:31:28 -08:00
ice_iix 80c740c1c5 Update to cgmath 0.16.1, collision 0.18.0
https://github.com/iceiix/steven/issues/4
2018-10-27 18:11:26 -07:00
iceiix b17f296ab4
Replace hyper with reqwest (#7)
An old version of hyper was used before (0.8.0), in the process of updating to hyper 0.12.11, found this higher-level replacement/wrapper, reqwest 0.9.4 which is simpler to use than the latest hyper and serves the purpose of a simple HTTP client well

* Begin updating to hyper 0.12.11

https://github.com/iceiix/steven/issues/4#issuecomment-425759778

* Use type variables for hyper::Client

* Fix setting header syntax, Content-Type: application/json, 17->13

* Parse strings into URLs with url.parse::<hyper::Uri>().unwrap()

b20971cb4e/examples/client.rs (L25)

* Use hyper::Request::post() then client.request() since client.post() removed

* wait() on the ResponseFuture to get the Result

* try! to unwrap the Result

* status() is now a method

* Concatenate body chunks unwrap into bytes, then parse JSON from byte slice, instead of from_reader which didn't compile

* Replace send() with wait() on ResponseFuture

* Parse HeaderValue to u64

* Slices implement std::io::Read trait

* Read into_bytes() instead of read_to_end()

* Disable boxed logger for now to workaround 'expected function, found macro'

* Remove unnecessary mutability, warnings

* Hack to parse twice to avoid double move

* Use hyper-rustls pure Rust implementation for TLS for HTTPS in hyper

* Start converting to reqwest: add Protocol::Error and reqwest::Error conversion

* Use reqwest, replacing hyper, in protocol

* Convert resources to use reqwest instead of hyper

* Convert skin download to reqwest, instead of hyper

* Remove hyper

* Revert unnecessary variable name change req/body to reduce diff

* Revert unnecessary whitespace change to reduce diff, align indentation on .

* Fix authenticating to server, wrong method and join URL

* Update Cargo.lock
2018-10-27 17:03:34 -07:00
iceiix de6cd2044e
Update to serde_json 1.0 (#6)
* Replace find() with get()

* Update for renamed as_string->as_str and as_boolean->as_bool

https://github.com/serde-rs/json/releases/tag/v0.8.0
Value::as_string() has been renamed to as_str() and Value::as_boolean() has been renamed to as_bool() to improve consistency
https://github.com/serde-rs/json/issues/126

* No serde_json::Value::I64/U64/F64 anymore, only Number

* Update from lookup() to pointer(), using JSON pointer syntax

https://github.com/iceiix/steven/pull/6#issuecomment-432472123

* Remove unused and removed ObjectBuilder import

* Use into_iter().collect() to convert BTreeMap to serde_json::Map

* Change parse_rules to accept serde_json::Map instead of BTreeMap

* Remove unused serde_json macro_use

* Update Cargo.lock
2018-10-23 18:47:21 -07:00
ice_iix edbed5e319 Check glGetError() in rendering loop
For investigating https://github.com/iceiix/steven/issues/5
No errors seen
2018-10-07 13:53:50 -07:00
ice_iix 7731117e4f Check framebuffer statuses before rendering and unbinding
No errors, so not the cause of https://github.com/iceiix/steven/issues/5
2018-10-07 08:00:07 -07:00
ice_iix 84c682b177 Check framebuffer status later not immediately after binding
No errors https://github.com/iceiix/steven/issues/5
2018-10-06 13:58:16 -07:00
ice_iix fe99910550 Update to image 0.20.0 2018-09-30 17:21:05 -07:00
ice_iix fa8f7bb9b9 Increase sample count to 2 to fix/workaround rendering issue #74 https://github.com/Thinkofname/steven/issues/74 2018-09-29 17:31:16 -07:00
llogiq 5e0c041a71 Fixed another batch of clippy warnings
Those are mostly readability-related. Also did a cargo update.
2016-09-15 15:15:52 +01:00
Thinkofname 2e3d9a0a4b Fix skins reverting to default on reload 2016-04-25 13:45:13 +01:00
Thinkofname 61829c055a Fix a crash caused by trying to load a skin whilst missing vanilla resources 2016-04-25 13:31:24 +01:00
Thinkofname 3b7d2cb8ee Fix default textures being replaced with the missing texture on reload 2016-04-25 12:05:57 +01:00
Thinkofname a7caa50b6f Rewrite the UI system (Closes #12) 2016-04-24 12:29:25 +01:00
Thinkofname 3038596b27 Simplify chunk loading 2016-04-21 21:20:28 +01:00
Thinkofname df37ec283d Handle errors when fetching skins better 2016-04-21 13:09:20 +01:00
Thinkofname 380a844272 Implement a background for the option menus 2016-04-21 11:00:05 +01:00
Thinkofname cc481d55bb Fix multiple skin rendering issues (Fixes #43) 2016-04-16 21:44:05 +01:00
Thinkofname a644f3ac8f Handle unused uniforms and attributes better 2016-04-09 11:08:17 +01:00
Thinkofname accf01e1fb Fix the skin processing thread crashing on shutdown 2016-04-08 11:48:26 +01:00
Thinkofname ea23219993 Remove debug logging from skin fetching 2016-04-07 20:44:21 +01:00
Thinkofname 698c0d9dda Support old style skins 2016-04-07 20:44:21 +01:00
Thinkofname 93f1d44171 Fix a crash with dynamic textures 2016-04-07 20:44:21 +01:00
Thinkofname 56bddaed27 Cache downloaded skins 2016-04-07 16:12:33 +01:00
Thinkofname 8469b32061 Initial skin support 2016-04-07 15:55:03 +01:00
Thinkofname 0d9073420c Add fancy clouds 2016-04-01 20:01:10 +01:00
Thinkofname bb1f10dd1b Fix animated textures playing too fast 2016-03-30 00:53:43 +01:00
Thinkofname 93bcd1e083 Rework the dynamic texture system to be less stupid 2016-03-28 19:06:10 +01:00
Thinkofname 7fbbdf7686 Minor optimization 2016-03-28 00:50:30 +01:00
Thinkofname 2b26f841d0 Implement models and a sun/moon 2016-03-27 23:31:57 +01:00
Thinkofname 26bca302aa Minor tweaks 2016-03-27 13:27:31 +01:00
Thinkofname c70f9548c6 Follow some of clippy's suggestions 2016-03-26 14:24:26 +00:00
Thinkofname c25dba3c8b Fix some warnings 2016-03-26 13:28:14 +00:00
Thinkofname c77f05ed93 Daylight cycle and make the sky color match vanilla 2016-03-25 13:47:31 +00:00
Thinkofname 3738c5a0c0 Liquid rendering 2016-03-25 09:47:39 +00:00
Thinkofname d7bc0b2b0f Transparent renderering 2016-03-25 01:17:03 +00:00
Thinkofname 93abbcc7cb Reload textures earlier 2016-03-25 00:25:34 +00:00
Thinkofname de673f1ee1 Implement better chunk culling 2016-03-24 23:27:22 +00:00
Thinkofname 7692c54cf7 More layout changes to chunk rendering 2016-03-24 21:47:11 +00:00
Thinkofname 70ccd5cd3d Tidy up chunk rendering 2016-03-24 21:13:24 +00:00
Thinkofname 12b1dd6445 Initial block model support 2016-03-24 15:39:57 +00:00
Thinkofname 11a4fcb33d Minor changes 2016-03-22 14:42:10 +00:00
Thinkofname 169f068f75 Add frustum culling 2016-03-22 11:47:02 +00:00
Thinkofname 47297146cf Fix a mistake with aspect calculation 2016-03-22 11:27:57 +00:00
Thinkofname e6477bd186 Spectator style movement + chunk unloading 2016-03-21 22:34:57 +00:00
Thinkofname 8d141b1310 Implement block shading 2016-03-21 19:53:00 +00:00
Thinkofname fd4df88c32 Initial work on connecting to servers 2016-03-20 12:04:02 +00:00
Thinkofname edee182bf9 Use BufferSubData instead of MapBuffer 2016-03-19 20:35:31 +00:00
Thinkofname 65370ccfe0 Remove a debug message 2016-03-19 19:07:01 +00:00
Thinkofname 6bee18b68c Initial rendering implementation 2016-03-19 18:09:10 +00:00
Thinkofname ad81ef8f17 Basic chunk building (not rendering) 2016-03-19 16:32:13 +00:00
Thinkofname 7f10580b67 Prep for chunk rendering 2016-03-18 17:16:03 +00:00
Thinkofname 72712e4d42 Transparent rendering work 2016-03-18 15:19:50 +00:00
Thinkofdeath 70b6738d87 Update copyright 2016-03-16 18:25:35 +00:00
Thinkofdeath f1b940fdd1 Clean up 2016-03-16 18:01:33 +00:00
Thinkofdeath 479ba4f03e Get into a runnable state 2016-03-16 17:53:04 +00:00
Thinkofdeath e9631f044d Add last state before I stopped 2016-03-16 17:33:06 +00:00
Thinkofdeath 3704b9eeb8 Reformat using rustfmt 2015-10-07 19:36:59 +01:00
Thinkofdeath b9abf4b9a6 Clean up shader creation 2015-10-06 23:49:52 +01:00
Thinkofdeath 302af6393d Tidy up 2015-09-29 20:09:36 +01:00
Thinkofdeath fcacd91e3a Clean up 2015-09-25 15:20:55 +01:00
Thinkofdeath 0d3ff98ad5 Implement the refresh button 2015-09-25 14:48:35 +01:00
Thinkofdeath 3bcfc6aa4c Kinda functional server list 2015-09-25 14:00:49 +01:00
Thinkofdeath 93edfa3828 Base of server list 2015-09-23 20:16:25 +01:00
Thinkofdeath 81b62d9ce4 Add internal resources 2015-09-19 19:08:28 +01:00
Thinkofdeath 1ab2683a53 Base of ui system 2015-09-18 22:02:08 +01:00
Thinkofdeath 72e27968eb Add license 2015-09-17 16:23:07 +01:00
Thinkofdeath 5aef272d43 Base of ui complete 2015-09-17 16:04:25 +01:00