Commit Graph

801 Commits

Author SHA1 Message Date
ice_iix 1d967d0079 Revert fb_color to a texture so the fragment shader can access it (tcolor) 2020-12-27 12:35:56 -08:00
ice_iix 173317484d fb_depth a Renderbuffer, too 2020-12-27 12:01:30 -08:00
ice_iix 15fc418501 Change fb_color to a Renderbuffer (was a Texture) 2020-12-27 11:57:29 -08:00
ice_iix d0cd81fbf9 gl: add glRenderbufferStorage wrapper (non-multisample) 2020-12-27 11:38:56 -08:00
ice_iix f0d722457e Merge branch 'master' into renderbuffer 2020-12-27 10:42:25 -08:00
iceiix 8e728830b3
render: disable clouds on wasm (#448)
No clouds on wasm since no geo shaders on WebGL
Needed for 🕸️ Web support #446, to fix "invalid shader type", see https://github.com/iceiix/stevenarella/pull/442#issuecomment-751428548
2020-12-27 10:42:01 -08:00
ice_iix 1b7c37571f Merge branch 'master' into renderbuffer 2020-12-27 10:17:17 -08:00
iceiix b8b4cb07a7
Disable multisampled textures, glTexImage2DMultisample (#447)
Steven used multisampled textures from the beginning, but this caused
incompatibilities: https://github.com/Thinkofname/steven/issues/74.
Subsequently fixed by increasing the number of samples, but increasing
it beyond the limit caused more incompatibilities, so it was clamped to
the maximum samples reported as supported by the system.

Fast-forward to now, as part of adding WebGL support (#446), the use of
multisampled textures via the glTexImage2DMultisample() call is
unsupported on this platform. Replace the following:

* glTexImage2DMultisample -> glTexImage2D
* TEXTURE_2D_MULTISAMPLE -> TEXTURE_2D
* sampler2DMS -> sampler2D

This disables the custom multisampling anti-aliasing algorithm (MSAA)
implemented in the chunk fragment shader, increasing compatibility:

* Update to glow release, remove image_2d_sample()

MSAA may be added back at a later date using multisampled renderbuffers
instead, see #442.
2020-12-27 10:14:39 -08:00
ice_iix 6071a21904 Update to glow release, remove image_2d_sample() 2020-12-27 09:27:26 -08:00
ice_iix 7826c2a5d0 gl: use glow::Renderbuffer 2020-12-26 21:25:02 -08:00
ice_iix b15129fc16 render: fix missing TEXTURE_2D{_MULTISAMPLE} in draw() 2020-12-26 21:12:08 -08:00
ice_iix bda3c99440 Revert "Use local copy of glow modified with [features] debug_trace_calls, debug_automatic_glGetError"
This reverts commit 19231f043a.
2020-12-26 21:11:53 -08:00
ice_iix 19231f043a Use local copy of glow modified with [features] debug_trace_calls, debug_automatic_glGetError 2020-12-26 21:11:50 -08:00
ice_iix 1b400d1d17 fb_depth use DEPTH_COMPONENT for both format/internalformat 2020-12-26 20:57:21 -08:00
ice_iix f12f10c2a1 Try fb_depth same image_2d_ex parameters as trans_depth 2020-12-26 20:55:54 -08:00
ice_iix 93e0c2d096 Enable debug-assertions in dev 2020-12-26 20:48:10 -08:00
ice_iix b908e8667e Try disabling multisampling again 2020-12-26 20:25:24 -08:00
ice_iix 0953cc2871 Merge branch 'master' into renderbuffer 2020-12-26 19:56:57 -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
ice_iix 7ec4feb5ac cargo fmt 2020-12-25 10:53:11 -08:00
ice_iix 7342c28e6b Revert "Attempt to disable multisampling (glTexImage2D instead of glTexImage2DMultisample), but nothing shows up"
This reverts commit 5b972cb3ec.
2020-12-25 10:23:02 -08:00
ice_iix 03f7a4f880 Update to use renderbuffers in glow 2020-12-25 10:20:34 -08:00
ice_iix f34d681b74 Merge branch 'master' into renderbuffer 2020-12-25 10:11:43 -08:00
iceiix 0aa062f4b8
Use glow, GL on Whatever (#262)
Replaces the use of gl_generator with the glow wrapper:

* Add glow dependency, based on glow 0.6.1

* Pin version of glow fork for https://github.com/iceiix/glow/pull/1 until #442 renderbuffer

* Remove gl module, steven_gl

Porting details:
* Initialize glow in src/gl/mod.rs
* Call gl methods on glow context
* glow uses camelcase
* Import glow::HasContext trait, finds draw_elements etc.
* Fix mismatched types, glow uses Option and &str instead of raw pointers
* Fix uniform_location, glow already returns Some(u32)
* uniform_location: convert i32 to u32 for Uniform
* Fix attribute_location
* Fix shader creation Result u32 type 
* Fix passing GLvoid and 2d/3d
* Fix missing Options type mismatches
* Offsets are i32 in glow, not GLvoid
* Fix clear_buffer using _f32_slice
* Delete methods are singular not plural
* glBufferData -> buffer_data_u8_slice
* buffer_sub_data_u8_slice
* Update more glow method wrapper names found by reviewing glow native platform
* Remove unused multi_draw_elements, can be replaced by draw_elements in a loop and it has no WebGL equivalent
* glow implements glMapBufferRange
* Remove unused read_buffer
* glow's deletes automatically pass 1 and take no reference
* shader_source() accepts &str directly; removes last of std::ptr
* Pass uniform Option<u32>
* Fix bool passing normalized parameter
* Fix draw_buffers parameter
* Stop unnecessarily returning context from gl::init
* Getting shader info is unsafe 
* Unwrapping static mut is unsafe
* Use unsafe raw pointers for global mutable context
* Fix initializing GL objects wrappers from glow wrappers
* Unbinding framebuffers uses None
* Uppercase global to fix warning
* Shaders return Some instead of None
* Unbox the context to a raw pointer
* Use tex_image_2d_multisample added in glow fork 
* Implement uniform_location, fixing unwrap None failed
* Add tex_sub_image_3d, using PixelUnpackData::Slice
* set_matrix4: transmute the Matrix4 since it is repr(C)
* get_pixels -> get_tex_image -> glGetTexImage, with PixelPackData::Slice
* Wrap sub_image_2d (glTexSubImage2D) and fix warnings
* Implement set_float_multi_raw and set_matrix4_multi, using from_raw_parts
2020-12-25 10:00:22 -08:00
ice_iix 0647017441 cargo fmt 2020-12-24 19:01:33 -08:00
ice_iix 5b972cb3ec Attempt to disable multisampling (glTexImage2D instead of glTexImage2DMultisample), but nothing shows up 2020-12-24 17:59:33 -08:00
ice_iix 08e5c8df24 gl: Add RenderbufferStorageMultisample wrapper storage_multisample 2020-12-24 14:14:44 -08:00
ice_iix 55ac2fd034 Wrap some renderbuffer GL methods 2020-12-24 12:55:59 -08:00
ice_iix 9700ffe34d Update readme, add link to discussion forum and Freenode channel 2020-12-20 16:21:02 -08:00
iceiix 9bc10c1100
Update to glutin 0.26.0 + winit 0.24.0 (#334)
* Update for ModifiersChanged event

* Consistently use logical position and size

CursorMoved gives us a PhysicalPosition, which needs to be converted
to LogicalPosition to properly track the mouse movement. Change the
width/height passed to be a LogicalSize instead of a PhysicalPosition,
matching the LogicalPosition.
2020-12-20 08:18:39 -08:00
ice_iix 5d0fb7fa64 Update dependencies: reqwest, serde/json, structopt...
Closes #425 build(deps): bump wasm-bindgen from 0.2.68 to 0.2.69
Closes #426 build(deps): bump structopt from 0.3.20 to 0.3.21
Closes #427 build(deps): bump serde_json from 1.0.59 to 1.0.60
Closes #428 build(deps): bump serde from 1.0.117 to 1.0.118
Closes #433 build(deps): bump reqwest from 0.10.9 to 0.10.10
2020-12-19 17:48:13 -08:00
iceiix 433429e8a0
1.16+: implement EntityEquipment_Array top-bit terminated variant (#439)
Fixes #408 1.16.1: EntityEquipment_VarInt : Main thread panic: Failed to read all of packet 0x47, had 363 bytes left - enchants
Fixes #421 1.16.1: EntityEquipment_VarInt : Player heads break things. (Failed to read all of packet 0x47, had 1292 bytes left)
2020-12-19 15:51:27 -08:00
ice_iix 37f55e2c57 Add --network-parse-packet option 2020-12-19 15:32:19 -08:00
ice_iix 47dd9ac112 Update protocol Cargo.lock 2020-12-19 15:32:14 -08:00
iceiix 710a7732ef
Update to Rust 1.48 (#424)
* Update to Rust 1.48.0

* Fix clippy::single_char_push_str warnings

* Fix clippy::manual_strip warnings
2020-11-24 19:35:55 -08:00
ice_iix f3faae383e Bump image to 0.23.12 (closes #422) 2020-11-24 19:02:18 -08:00
ice_iix da137ca9b4 Update deps: cfg-if, serde/_json, structopt...
Bump cfg-if to 1.0.0 (closes #412)
Bump serde to 1.0.117 (closes #416)
Bump serde_json to 1.0.59 (closes #413)
Bump structopt to 0.3.20 (closes #414)
Bump flate2 to 1.0.19 (closes #420)
Bump reqwest to 0.10.9 (closes #423)
2020-11-24 19:02:18 -08:00
iceiix 4a757656ab 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocol (#390)
Adds support for 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocols

* Update packet IDs and readme

* Add and handle ChunkData_Biomes3D_VarInt variant

* Support world chunk data padded bit map array

* Add and handle JoinGame_WorldNames_IsHard variant

* Add and handle MultiBlockChange_Packed variant

* Add UnlockRecipes_WithBlastSmoker variant

* Add SetDisplayedRecipe and SetRecipeBookState packets
2020-11-24 19:01:57 -08:00
iceiix f4414e7814
Update to Rust 1.47.0 (#411) 2020-10-10 16:53:03 -07:00
ice_iix ff90d8af6a Use `matches!` for bool match (clippy match_like_matches_macro) 2020-10-10 16:22:46 -07:00
ice_iix 1234588974 protocol: cargo update 2020-10-10 14:30:36 -07:00
ice_iix 79669264a6 Update to Rust 1.47.0 2020-10-10 13:14:13 -07:00
ice_iix ab4600011d Update image and base64 dependencies
Closes #396 bump image from 0.23.6 to 0.23.10
Closes #404 bump base64 from 0.12.3 to 0.13.0
2020-10-10 12:39:44 -07: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 d9399015cd Update deps: log, reqwest, serde_json, flate2, structopt...
Closes #372 bump log from 0.4.8 to 0.4.11
Closes #387 bump reqwest from 0.10.6 to 0.10.8
Closes #391 bump wasm-bindgen from 0.2.64 to 0.2.68
Closes #403 bump serde_json from 1.0.56 to 1.0.58
Closes #405 bump flate2 from 1.0.16 to 1.0.18
Closes #409 bump structopt from 0.3.15 to 0.3.19
2020-10-10 12:04:21 -07:00
Terminator 85c1014f86
Don't consume self when writing packet to a writer. Mutability is not affected (#375)
* Minor change: Don't consume self when writing packet to a writer. Mutability is not affected.

* Further decrease packet write requirements

Co-authored-by: Terminator <terminator@nonexistent.com>
2020-10-09 19:36:55 -07:00
ice_iix 685e60387e Update build instructions for Debian/Ubuntu, adding package to match GitHub Actions configuration (updates #402) 2020-10-09 19:32:52 -07:00
Bart Ribbers 1a817d29c1
Improve build instructions (#402)
Add dependencies required to build some Rust crates for at least
Debian/Ubuntu and Alpine Linux

Fixes #397
2020-10-09 19:31:40 -07:00
ice_iix 7869893038 GitHub Actions: run clippy, fmt; remove other CI (#365)
Consolidates the multitude of CI systems, replacing Azure, SourceHut, and
AppVeyor with GitHub Actions, which now also runs clippy and fmt. See #352

* Add task to run clippy

* Add task to check formatting

* Test on 1.44.1 toolchain

* Update readme: status badge and downloads on GitHub Actions

* Remove strip binary task, leave it unstripped to allow debugging for now

* Rename task to install dependencies

* Remove Azure Pipelines

* Remove sr.ht SourceHut CI

* Remove AppVeyor
2020-07-05 12:14:37 -07:00
ice_iix dbca7464bd Enable static CRT (in git), closes #318 2020-07-05 11:20:34 -07:00
ice_iix f5f61e071e Update flate2, serde_json, wasm-bindgen; +gl/protocol
Bump flate2 to 1.0.16, closes #350
Bump serde_json to 1.0.56, closes #349
Bump wasm-bindgen to 0.2.64, closes #348
gl: Bump libc to 0.2.71
protocol: Bump hex to 0.4.2
protocol: Bump aes to 0.4.0
protocol: Bump cfb8 to 0.4.0
protocol: Bump num-traits to 0.2.12
2020-07-05 08:45:34 -07:00
ice_iix 759cef1255 protocol: commit Cargo.lock 2020-07-05 08:25:50 -07:00
ice_iix d362f136f1 1.15.1+: handle SpawnPlayer variant, fixes #357 2020-07-05 00:21:26 -07:00
iceiix 1fabc0c5bf
server_list: implement server deletion, fixes #355 (#361)
Adds a delete_server screen to delete servers, handled by clicking
the "X" button on the server list, similar to the "E" button for edit_server.
2020-07-04 17:42:17 -07:00
ice_iix 4e9cda2929 protocol: add missing minecraft:uuid CommandNode property
Fixes thread '<unnamed>' panicked at 'unsupported command node parser minecraft:uuid', protocol/src/protocol/packet.rs:3098:22
This was added in https://wiki.vg/index.php?title=Command_Data&diff=15659&oldid=14622
2020-07-04 14:48:33 -07:00
ice_iix eb703f0776 protocol: log bad format color codes, fixes #353 2020-07-03 16:33:23 -07:00
ice_iix 64fc29796d server_list: fix pre-1.13 favicon data, #353 (#354)
The server list ping response contains a base64-encoded favicon image,
which in pre-1.13 servers can have embedded newlines:
https://wiki.vg/Server_List_Ping#Response

> The favicon should be a PNG image that is Base64 encoded (without
> newlines: \n, new lines no longer work since 1.13) and prepended
> with data:image/png;base64,.

If this was the case, base64 decode would fail with a DecodeError,
similar to Invalid byte (76, 10). We now strip the whitespace, so the
base64 favicon can be decoded properly.
2020-07-03 16:07:36 -07:00
iceiix 301dfdc200
Merge pull request #347 from iceiix/clippy
Fix clippy warnings
2020-07-03 10:53:59 -07:00
ice_iix bb6d856879 Azure: fail on clippy all (deny) 2020-07-02 18:22:41 -07:00
ice_iix 337ee74b22 Allow verbose bit mask because this is in a performance-critical path, tick(), and it is faster on Intel according to https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask 2020-07-02 18:11:52 -07:00
ice_iix 9cfb686528 Use cmp match to replace if chain (comparison_chain) 2020-07-02 17:58:12 -07:00
ice_iix 476d46cac6 Use into_*(self) convention, fixes wrong_self_convention 2020-07-02 17:51:51 -07:00
ice_iix 5ce06c3067 Suppress type_complexity, would not be clarified by using a type definition 2020-07-02 17:49:04 -07:00
ice_iix 7ef173416a Suppress needless_range_loop in chunk loading for clarity -- it will always be 16, and this value is not from block_types, blocks_meta, blocks_add, but must be consistent with all variables and is part of the wire protocol 2020-07-02 17:47:12 -07:00
ice_iix 0d1e86a233 Box block update sign text to reduce enum size from 268 bytes (large_enum_variant)
warning: large size difference between variants
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^ this variant is 268 bytes
   |
   = note: `#[warn(clippy::large_enum_variant)]` on by default
note: and the second-largest variant is 12 bytes:
  --> src/world/mod.rs:53:5
   |
53 |     Remove(Position),
   |     ^^^^^^^^^^^^^^^^
help: consider boxing the large fields to reduce the total size of the enum
  --> src/world/mod.rs:54:5
   |
54 | /     UpdateSignText(
55 | |         Position,
56 | |         format::Component,
57 | |         format::Component,
58 | |         format::Component,
59 | |         format::Component,
60 | |     ),
   | |_____^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
2020-07-02 17:39:40 -07:00
ice_iix f88036ea4e Use byte literal b"" instead of as_bytes (string_lit_as_bytes) 2020-07-02 17:29:16 -07:00
ice_iix 7f5ab06c34 Use !is_empty instead of length check (len_zero) 2020-07-02 17:25:55 -07:00
ice_iix 113abefd80 Fix unnecessary use of match with if let (single_match) 2020-07-02 17:22:24 -07:00
ice_iix deb35db895 Use more descriptive name to fix blacklisted_name 'bar' (as in foobar) 2020-07-02 17:17:51 -07:00
ice_iix 2e2c82eae4 Use if let pattern match to fix unnecessary_wrap 2020-07-02 17:14:49 -07:00
ice_iix 9939eae361 Use values_mut() to iterate map values (for_kv_map) 2020-07-02 17:07:48 -07:00
ice_iix 35f29705b3 Use question mark operator idiom (question_mark) 2020-07-02 16:53:27 -07:00
ice_iix c27425750d Change set_float_multi_raw to unsafe because it dereferences a raw pointer argument (not_unsafe_ptr_arg_deref); fix typo 2020-07-02 16:51:50 -07:00
ice_iix 0f9dcd2515 Use unwrap_or_else to fix two or_fun_call and suppress one 2020-06-30 19:09:15 -07:00
ice_iix 07fd4788e1 Use += to fix assign_op_pattern 2020-06-30 19:03:59 -07:00
ice_iix bffb33297f Allow float_cmp since we use it to check if floating point values changed from the last value assigned, not compare two different floating point values; downgrade not_unsafe_ptr_arg_deref to warning 2020-06-30 19:01:17 -07:00
ice_iix c4690bba32 Use add(x) instead of offset(x as isize), fixes ptr_offset_with_cast 2020-06-30 18:56:08 -07:00
ice_iix 8a0936faac Disable clippy::let_and_return for now in src/render/mod.rs 2020-06-30 18:53:33 -07:00
ice_iix d496eaf3bb Use is_*() instead of if let x(_), fixes redundant_pattern_matching 2020-06-30 18:50:46 -07:00
ice_iix b4aa23ecf5 Use if let instead of map, fixes option_map_unit_fn 2020-06-30 18:48:25 -07:00
ice_iix 3aaa14eb80 steven_gl: suppress clippy warnings in gl-generated code 2020-06-30 18:36:20 -07:00
M*C*O 6b13fa3aab
Add CD via Github Actions (#351). Closes #93
* Add first action

* Install libxcb-composite0-dev, fix job name

* Use apt-get instead of apt, more descriptive names for os-specific steps

* Also match .exe, thanks windows

* use upload-artifact v2

* Specifically pick out the binary for upload

* Fix step name

* Name binary after target os
2020-06-30 17:51:29 -07:00
ice_iix 98dff0b390 Fix redundant clones 2020-06-29 18:48:07 -07:00
ice_iix 8fb5491e15 Add missing default implementations (new_without_default) 2020-06-29 18:42:07 -07:00
ice_iix 9d88168d0e Fix collapsible_if in lighting update 2020-06-29 18:26:53 -07:00
ice_iix 55856ccf1b Allow TeleportFlag enum variant names Rel..., Rel..., as they are all relative 2020-06-29 18:26:29 -07:00
ice_iix e8c066cd26 Clippy: allow too_many_arguments, many_single_char_names 2020-06-29 18:17:16 -07:00
ice_iix fe5cb47d40 Fix redundant field names in struct initialization (redundant_field_names) 2020-06-29 18:07:12 -07:00
ice_iix 132b40c19e Fix collapsible_if in main game loop 2020-06-29 18:06:51 -07:00
ice_iix c2e3ddb805 Fix write_with_newline, use writeln 2020-06-29 18:06:35 -07:00
ice_iix c3038f82ce Remove redundant imports (single_component_path_imports) 2020-06-29 18:01:02 -07:00
ice_iix 6267509cbe resources: use writeln macro, fixing write_with_newline 2020-06-29 17:50:08 -07:00
ice_iix cb8681a615 protocol: use mutable iterator populating Biomes3D (needless_range_loop) 2020-06-29 17:43:49 -07:00
ice_iix 66a787a535 protocol: change UUID from_str to implement FromStr trait (should_implement_trait) 2020-06-29 17:43:49 -07:00
ice_iix 783e437397 protocol: fix manually copying, use clone_from_slice, thanks clippy! (manual_memcpy) 2020-06-28 18:39:57 -07:00
ice_iix 72f0595111 protocol: fix wildcard_in_or_patterns 2020-06-28 18:36:16 -07:00
ice_iix 2f1c7b3c60 protocol: fix redundant_clone in access token 2020-06-28 18:34:42 -07:00
ice_iix 77394f0536 protocol: use and_then, ok_or_else; option_map_or_none and or_fun_call 2020-06-28 18:33:32 -07:00
ice_iix 07fed441f3 protocol: fix redundant_field_names 2020-06-28 18:28:09 -07:00
ice_iix 853f76b24a protocol: fix redundant_static_lifetimes 2020-06-28 18:27:30 -07:00