Giter Site home page Giter Site logo

rust-doom's Introduction

Build Status

Rust Doom

A little Doom 1 & 2 Renderer written in Rust. Mostly written while I was learning the language starting around 6 years ago, so it might not the best example of Rust code! PR-s are welcome.

The code is mostly based on the endlessly useful Doom Wiki and the Unofficial Doom Specs. It is not a port of the original Doom C source code into Rust; I've been doing my best to make the code as idiomatic as possible and have not looked at the original in a long time.

Note: You need a WAD file to try this. Get a shareware one if you don't own the game.

Screenshots

Zig-zag Screenshot Doom 2 Screenshot

Build Instructions

Rust Doom should always build on the latest stable version of Rust (but is also tested on beta and nightly), which you can install using any of the methods described on the Rust website.

To build, run cargo in the project's root (where Cargo.toml is):

cargo build --release

Note that you'll need a WAD file (which contains the game's levels and art assets). If you own the game (or are willing to buy it for a few quid/bucks), you'll find the WAD in your game folder. If not, you can use the shareware ones floating around on the interwebs. Or, though I would not know of such things, you may be able to obtain the originals for free in less.... savoury parts of the internet.

Copy the WAD file to the repo root (where Cargo.toml is). Then, to run:

target/release/rs_doom --iwad your_wad_file.wad

Without any flags it will try to load the first level of 'doom1.wad'. You can specify which level to load, FOV and resolution preferences using the flags. Run with '-h' for a list of options.

Goals

(subject to change)

  • Modern OpenGL 3+ renderer. No immediate mode shenanigans: it's all VBO-s and shaders. Unlike some GL ports, the floors are actually rendered as convex polygons computed from the BSP. The downside of this (or upside depending on your perspective) is that some visual glitches (like slime trails) don't show up.
  • Correct 256 color palette. Uses the original palette and colormaps to replicate the original lighting effects (mostly you'll notice things get darker in visible steps and they also get greyer as they get darker). Doing 256 color palette lookups in a fragment shader is wonderfully anachronistic.
  • Free flying camera. Mouse & keyboard control for full 6 degrees of freedom.
  • 100% safe code. No pesky unsafe blocks anywhere.

Todo

  • BSP -> convex subsector conversion.
  • Flats (floors & ceiling) texture mapping.
  • Wall texture mapping.
  • Wall texture alignment.
  • Scrolling walls.
  • Animated flats.
  • Animated walls.
  • Lighting effects (flickering, flashing, glow etc.)
  • Sky rendering.
  • Sprite rendering.
  • Correct player movement (falling etc.)
  • Player-flat collisions.
  • Player-wall collisions.
  • Sprite-player and sprite-sprite collisions.
  • Sprite animations.
  • BSP frustum culling.

rust-doom's People

Contributors

anryko avatar bombless avatar cristicbz avatar csherratt avatar horki avatar ivuk avatar jdunne-kaplan avatar jightuse avatar llogiq avatar penberg avatar ryman avatar steveklabnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-doom's Issues

World should be stretched vertically by 20%

It looks like everything in the world is being drawn with texels of aspect ratio 1:1, which seems like the obvious thing to do. But Doom was designed to run in 320x200 (a 16:10 resolution) on a 4:3 (i.e. 16:12) monitor. This means that everything the game displayed was stretched vertically by 20% - the 1:1 texels are displayed as 5:6.

Here's an example. Doom as it's supposed to look:

Normal Doom

Doom as it looks in Doom95, which didn't take the stretching into account:

Doom95

More info on this quibble can be found at http://doomwiki.org/wiki/Aspect_ratio

Unspecific error message when `doom.toml` is missing

./rs_doom --iwad doom.wad
rs_doom: No such file or directory (os error 2)

rust-doom exits with No such file or directory without telling the user which file is missing. Running it with strace showed me that It has tried to open the doom.toml, see below for details.

strace ./rs_doom --iwad doom.wad
...
read(6, "\f\0\0\0\0*\0\0PLAYPAL\0\f*\0\0\0\"\0\0COLORMAP"..., 65536) = 36896
open("doom.toml", O_RDONLY|O_CLOEXEC)   = -1 ENOENT (No such file or directory)
madvise(0x7fe38a4a5000, 49152, MADV_DONTNEED) = 0
close(6)                                = 0
madvise(0x7fe38a476000, 122880, MADV_DONTNEED) = 0
ioctl(5, DRM_IOCTL_I915_GEM_SW_FINISH, 0x7fffafcf2fe0) = 0
ioctl(5, DRM_IOCTL_I915_GEM_EXECBUFFER2, 0x7fffafcf2f70) = 0
ioctl(5, DRM_IOCTL_I915_GEM_BUSY, 0x7fffafcf2f30) = 0
ioctl(5, DRM_IOCTL_I915_GEM_MADVISE, 0x7fffafcf2f20) = 0
ioctl(5, DRM_IOCTL_I915_GEM_SET_DOMAIN, 0x7fffafcf2f40) = 0
ioctl(5, DRM_IOCTL_I915_GEM_SET_DOMAIN, 0x7fffafcf3040) = 0
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\215\5\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\312\0\2\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
recvmsg(3, 0x7fffafcf3510, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf3510, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\215\5\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\313\0\2\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
recvmsg(3, 0x7fffafcf33d0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf33d0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\3\5\2\0\v\0\300\2\16\0\2\0\v\0\300\2", 16}, {NULL, 0}, {"", 0}], 3) = 16
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\314\0\3\0\0\0\272\0\0\0\1\0\0\1\377\377\377\377\0\0\0\0\0\0\2\0\n\0\300\2"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 76
recvmsg(3, 0x7fffafcf3410, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf3410, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf3410, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf3410, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\n\5\2\0\v\0\300\2\31\0\v\0\305\0\0\0\0\0\30\0\22\0\0\0\305\0\0\0\v\0\300\2"..., 52}, {NULL, 0}, {"", 0}], 3) = 52
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\22\0\316\0\v\0\300\2\v\0\300\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64
recvmsg(3, 0x7fffafcf34a0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf34f0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\215\5\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\t\5\316\0\v\0\300\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 64
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\10\0\316\0\31\241\34\2\305\0\0\0\v\0\300\2\0\0\0\0\342\0\224\1\267\0c\1\0\0\0\3", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\320\0\2\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
recvmsg(3, 0x7fffafcf34b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"\4\5\2\0\v\0\300\2", 8}, {NULL, 0}, {"", 0}], 3) = 8
recvmsg(3, 0x7fffafcf3670, 0)           = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN|POLLOUT}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\21\0\321\0\v\0\300\2\v\0\300\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 640
writev(3, [{"\215\5\1\0", 4}, {NULL, 0}, {"", 0}], 3) = 4
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\322\0\2\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
recvmsg(3, 0x7fffafcf3570, 0)           = -1 EAGAIN (Resource temporarily unavailable)
sendmsg(4, {msg_name(0)=NULL, msg_iov(2)=[{"l\1\0\1\4\0\0\0\4\0\0\0\227\0\0\0\1\1o\0\34\0\0\0/org/fre"..., 168}, {"\225,m;", 4}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 172
close(4)                                = 0
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"<\5\2\0\0\0\300\2+\0\1\0", 12}, {NULL, 0}, {"", 0}], 3) = 12
poll([{fd=3, events=POLLIN}], 1, 4294967295) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\1\1\324\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(3, 0x7fffafcf35e0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7fffafcf35e0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
munmap(0x7fe38bfe0000, 4096)            = 0
ioctl(5, DRM_IOCTL_GEM_CLOSE, 0x7fffafcf3690) = 0
ioctl(5, DRM_IOCTL_GEM_CLOSE, 0x7fffafcf3690) = 0
ioctl(5, DRM_IOCTL_GEM_CLOSE, 0x7fffafcf3690) = 0
close(5)                                = 0
shutdown(3, SHUT_RDWR)                  = 0
close(3)                                = 0
munmap(0x7fe389674000, 2138928)         = 0
munmap(0x7fe389061000, 2105672)         = 0
munmap(0x7fe388e51000, 2159272)         = 0
munmap(0x7fe388c46000, 2138568)         = 0
munmap(0x7fe38946a000, 2134760)         = 0
rt_sigaction(SIGINT, NULL, {0x7fe38b951ae0, [], SA_RESTORER, 0x7fe38b59b680}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7fe38b59b680}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {0x7fe38b951ae0, [], SA_RESTORER, 0x7fe38b59b680}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7fe38b59b680}, NULL, 8) = 0
write(2, "rs_doom", 7rs_doom)                  = 7
write(2, ": ", 2: )                       = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, " (os error ", 11 (os error )             = 11
write(2, "2", 12)                        = 1
write(2, ")", 1))                        = 1
write(2, "\n", 1
)                       = 1
munmap(0x7fe38c035000, 8192)            = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Can't start doom

Hi.

I have followed the build instruction. But it cannot start.
I got the wad via shareware one.

rust-doom on ๎‚  master is ๐Ÿ“ฆ v0.0.9 via ๐Ÿฆ€ v1.50.0
โฏ env RUST_BACKTRACE=1 target/release/rs_doom --iwad doom1.wad
[INFO  engine::context] Creating system "tick"...
[INFO  engine::context] Creating system "frame_timers"...
[INFO  engine::context] Creating system "window"...
[INFO  winit::platform::platform::x11::window] Guessed window DPI factor: 1
[INFO  engine::context] Creating system "input"...
[INFO  engine::context] Creating system "entities"...
[INFO  engine::context] Creating system "transforms"...
[INFO  engine::context] Creating system "projections"...
[INFO  engine::context] Creating system "shaders"...
[INFO  engine::context] Creating system "uniforms"...
[INFO  engine::context] Creating system "meshes"...
[INFO  engine::context] Creating system "materials"...
[INFO  engine::context] Creating system "render_pipeline"...
[INFO  engine::context] Creating system "text_renderer"...
[INFO  engine::context] Creating system "wad"...
[INFO  wad::archive] Loading wad file '"doom1.wad"'...
[INFO  wad::archive] Loading metadata file '"assets/meta/doom.toml"'...
[INFO  wad::tex] Reading texture directory...
[INFO  wad::tex]     14 palettes
[INFO  wad::tex]     34 colormaps
[INFO  wad::tex] Reading 350 patches....
[INFO  wad::tex] Done in 1.59ms; 187 missing patches.
[INFO  wad::tex]    350 patches
[INFO  wad::tex] Reading & assembling textures...
[INFO  wad::tex]    125 textures in TEXTURE1
[INFO  wad::tex]      0 textures in TEXTURE2
[INFO  wad::tex] Done in 1.08ms.
[INFO  wad::tex]     54 flats
[INFO  wad::tex] Reading 483 sprites....
[INFO  wad::tex] Done in 3.19ms.
[INFO  wad::tex]    483 sprites
[INFO  game::wad_system] Loading initial level WadName("E1M1\u{0}\u{0}\u{0}\u{0}") (0)...
[INFO  wad::level] Reading level data for 'E1M1'...
[INFO  wad::level] Loaded level 'E1M1':
[INFO  wad::level]      138 things
[INFO  wad::level]      475 linedefs
[INFO  wad::level]      648 sidedefs
[INFO  wad::level]      467 vertices
[INFO  wad::level]      732 segs
[INFO  wad::level]      237 subsectors
[INFO  wad::level]      236 nodes
[INFO  wad::level]       85 sectors
[INFO  game::wad_system] Analysing level...
[INFO  wad::visitor] Computing dynamic sectors...
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[ERROR wad::visitor] Unknown linedef special type: 48
[INFO  wad::visitor] Finished computing dynamic sectors: num_dynamic_sectors=7 num_dynamic_linedefs=19
[INFO  engine::context] Creating system "game_shaders"...
[INFO  game::game_shaders] Building flats atlas...
[INFO  wad::tex] Flat atlas size: 512x256 (8, 3)
[INFO  game::game_shaders] Building walls atlas...
[INFO  wad::tex] Texture atlas size: Vector2 [1024, 512]
[INFO  game::game_shaders] Building sprite decorations atlas...
[INFO  wad::tex] Texture atlas size: Vector2 [128, 512]
[INFO  engine::context] Creating system "level"...
[INFO  game::level] Building new level...
[INFO  game::level] Walking level...
[INFO  game::level] Level built in 0.90ms:
        num_wall_quads = 926
        num_floor_polys = 237
        num_ceil_polys = 202
        num_sky_wall_quads = 46
        num_sky_floor_polys = 0
        num_sky_ceil_polys = 35
        num_decors = 129
        num_static_tris = 2527
        num_sky_tris = 205
        num_sprite_tris = 258
[INFO  game::level] Creating static meshes and models...
[INFO  engine::context] Creating system "hud"...
[INFO  engine::context] Creating system "player"...
[INFO  engine::context] Creating system "renderer"...
[INFO  engine::context] Setting up system "tick"...
[INFO  engine::context] Setting up system "frame_timers"...
[INFO  engine::context] Setting up system "window"...
[INFO  engine::context] Setting up system "input"...
[INFO  engine::context] Setting up system "entities"...
[INFO  engine::context] Setting up system "transforms"...
[INFO  engine::context] Setting up system "projections"...
[INFO  engine::context] Setting up system "shaders"...
[INFO  engine::context] Setting up system "uniforms"...
[INFO  engine::context] Setting up system "meshes"...
[INFO  engine::context] Setting up system "materials"...
[INFO  engine::context] Setting up system "render_pipeline"...
[INFO  engine::context] Setting up system "text_renderer"...
[INFO  engine::context] Setting up system "wad"...
[INFO  engine::context] Setting up system "game_shaders"...
[INFO  engine::context] Setting up system "level"...
[INFO  engine::context] Setting up system "hud"...
[INFO  engine::context] Setting up system "player"...
[INFO  engine::context] Setting up system "renderer"...
[INFO  engine::context] Context set up.
thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
   3: winit::platform::platform::x11::util::input::<impl winit::platform::platform::x11::xdisplay::XConnection>::query_pointer
   4: winit::platform::platform::x11::EventsLoop::process_event
   5: <engine::input::Input as engine::system::System>::update
   6: <engine::type_list::Cons<HeadT,TailT> as engine::context::SystemList<(HeadIndicesT,TailIndicesT)>>::update_list
   7: <game::game::GameImpl<WadIndexT,ContextT> as game::game::Game>::run
   8: rs_doom::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[INFO  engine::context] Tearing down system "renderer"...
[INFO  engine::context] Tearing down system "player"...
[INFO  engine::context] Tearing down system "hud"...
[INFO  engine::context] Tearing down system "level"...
[INFO  engine::context] Tearing down system "game_shaders"...
[INFO  engine::context] Tearing down system "wad"...
[INFO  engine::context] Tearing down system "text_renderer"...
[INFO  engine::context] Tearing down system "render_pipeline"...
[INFO  engine::context] Tearing down system "materials"...
[INFO  engine::context] Tearing down system "meshes"...
[INFO  engine::context] Tearing down system "uniforms"...
[INFO  engine::context] Tearing down system "shaders"...
[INFO  engine::context] Tearing down system "projections"...
[INFO  engine::context] Tearing down system "transforms"...
[INFO  engine::context] Tearing down system "entities"...
[INFO  engine::context] Tearing down system "input"...
[INFO  engine::context] Tearing down system "window"...
[INFO  engine::context] Tearing down system "frame_timers"...
[INFO  engine::context] Tearing down system "tick"...
[INFO  engine::context] Context tore down.
[INFO  engine::context] Destroying system "renderer"...
[INFO  engine::context] Destroying system "player"...
[INFO  engine::context] Destroying system "hud"...
[INFO  engine::context] Destroying system "level"...
[INFO  engine::context] Destroying system "game_shaders"...
[INFO  engine::context] Destroying system "wad"...
[INFO  engine::context] Destroying system "text_renderer"...
[INFO  engine::context] Destroying system "render_pipeline"...
[INFO  engine::context] Destroying system "materials"...
[INFO  engine::context] Destroying system "meshes"...
[INFO  engine::context] Destroying system "uniforms"...
[INFO  engine::context] Destroying system "shaders"...
[INFO  engine::context] Destroying system "projections"...
[INFO  engine::context] Destroying system "transforms"...
[INFO  engine::context] Destroying system "entities"...
[INFO  engine::context] Destroying system "input"...
[INFO  engine::context] Destroying system "window"...
[INFO  engine::context] Destroying system "frame_timers"...
[INFO  engine::context] Destroying system "tick"...
[INFO  engine::context] Context destroyed.

rust-doom on ๎‚  master is ๐Ÿ“ฆ v0.0.9 via ๐Ÿฆ€ v1.50.0
โฏ

Is my machine too small for doom?

โฏ macchina
    Kernel    โ€”  Linux 4.19.0-14-amd64
    Distro    โ€”  Debian GNU/Linux
    WM        โ€”  i3
    Packages  โ€”  2138
    Shell     โ€”  /usr/bin/fish
    Terminal  โ€”  Tmux: server
    Uptime    โ€”  7 hours
    CPU       โ€”  Intelยฎ Coreโ„ข i7-8565U CPU @ 1.80GHz (8)
    Memory    โ€”  2.7 GB/15.9 GB

Thanks for doom.

Cannot move (mouse on mac)

Console:
executed in GitHub/rust-doom

target/release/rs_doom --iwad Doom1.WAD
ERROR:wad::visitor: Unknown linedef special type: 48 <- this line multiple times.

Unreachable code branch

At line 205 here you can see that the else if branch will never be run because it's checking the same condition as the first if branch.

Here's the snippet

            if contact.time < 1.0 {
                (self.height * contact.time, Some(contact.normal))
            } else if contact.time < 1.0 {
                (self.height, Some(contact.normal))
            } else {
                (self.height, None)
            }

Build failed on rustc 1.2.0-nightly (9ad0063a1 2015-06-20)

$ rustc --version
rustc 1.2.0-nightly (9ad0063a1 2015-06-20)
$ cargo build --release
   Compiling math v0.0.1 (file:///Users/xxx/Development/rust/rust-doom)
src/math/mat.rs:20:1: 20:10 error: The attribute `packed` is currently unknown to the compiler and may have meaning added to it in the future
src/math/mat.rs:20 #[packed]
                   ^~~~~~~~~
src/math/mat.rs:20:1: 20:10 help: add #![feature(custom_attribute)] to the crate attributes to enable
error: aborting due to previous error
Could not compile `math`.

To learn more, run the command again with --verbose.

[meta] clippy warnings

Here's what clippy currently warns:

src/gfx/text.rs:28:40: 28:46 warning: you should put `OpenGL` between ticks in the documentation, #[warn(doc_markdown)] on by default
src/gfx/text.rs:28 /// Handles rendering of debug text to OpenGL
                                                          ^~~~~~
src/gfx/text.rs:28:40: 28:46 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown
src/math/mat.rs:10:5: 10:11 warning: you should put `OpenGL` between ticks in the documentation, #[warn(doc_markdown)] on by default
src/math/mat.rs:10 /// OpenGL.
                       ^~~~~~
src/math/mat.rs:10:5: 10:11 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown
src/math/sphere.rs:177:9: 177:10 warning: 5th binding whose name is just one char, #[warn(many_single_char_names)] on by default
src/math/sphere.rs:177     let a = 0.0;
                               ^
src/math/sphere.rs:177:9: 177:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#many_single_char_names
src/math/sphere.rs:178:9: 178:10 warning: 6th binding whose name is just one char, #[warn(many_single_char_names)] on by default
src/math/sphere.rs:178     let b = 1.0 - a;
                               ^
src/math/sphere.rs:178:9: 178:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#many_single_char_names
src/game/player.rs:115:64: 115:69 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/player.rs:115             if let Some(contact) = level.volume().sweep_sphere(&head, &displacement) {
                                                                                      ^~~~~
src/game/player.rs:115:64: 115:69 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/player.rs:162:60: 162:64 warning: approximate value of `f{32, 64}::PI` found. Consider using it directly, #[warn(approx_constant)] on by default
src/game/player.rs:162         let pitch = clamp(self.camera.pitch() + look[1], (-3.14 / 2.0, 3.14 / 2.0));
                                                                                  ^~~~
src/game/player.rs:162:60: 162:64 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#approx_constant
src/game/player.rs:162:72: 162:76 warning: approximate value of `f{32, 64}::PI` found. Consider using it directly, #[warn(approx_constant)] on by default
src/game/player.rs:162         let pitch = clamp(self.camera.pitch() + look[1], (-3.14 / 2.0, 3.14 / 2.0));
                                                                                              ^~~~
src/game/player.rs:162:72: 162:76 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#approx_constant
src/game/player.rs:205:23: 205:41 warning: this `if` has the same condition as a previous if, #[warn(ifs_same_cond)] on by default
src/game/player.rs:205             } else if contact.time < 1.0 {
                                             ^~~~~~~~~~~~~~~~~~
src/game/player.rs:203:16: 203:34 note: same as this
src/game/player.rs:203             if contact.time < 1.0 {
                                      ^~~~~~~~~~~~~~~~~~
src/game/player.rs:205:23: 205:41 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ifs_same_cond
src/game/level.rs:51:29: 51:44 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:51                             &wad.metadata(),
                                                 ^~~~~~~~~~~~~~~
src/game/level.rs:51:29: 51:44 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:157:56: 157:61 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:157                          .filter(|name| !is_untextured(&name))
                                                                             ^~~~~
src/game/level.rs:157:56: 157:61 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:173:5: 188:6 warning: this function has too many arguments (8/7), #[warn(too_many_arguments)] on by default
src/game/level.rs:173     fn build(level: &WadLevel,
                          ^
src/game/level.rs:173:5: 188:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/game/level.rs:242:9: 249:10 warning: the loop variable `i` is used to index `points`. Consider using `for (i, item) in points.iter().enumerate().skip(2)` or similar iterators, #[warn(needless_range_loop)] on by default
src/game/level.rs:242         for i in 2..points.len() {
                              ^
src/game/level.rs:242:9: 249:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
src/game/level.rs:265:9: 272:10 warning: the loop variable `i` is used to index `points`. Consider using `for (i, item) in points.iter().enumerate().skip(2)` or similar iterators, #[warn(needless_range_loop)] on by default
src/game/level.rs:265         for i in 2..points.len() {
                              ^
src/game/level.rs:265:9: 272:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
src/game/level.rs:277:9: 280:10 warning: the loop variable `i` is used to index `points`. Consider using `for (i, item) in points.iter().enumerate().skip(1)` or similar iterators, #[warn(needless_range_loop)] on by default
src/game/level.rs:277         for i in 1..points.len() {
                              ^
src/game/level.rs:277:9: 280:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
src/game/level.rs:285:9: 288:10 warning: the loop variable `i` is used to index `points`. Consider using `for (i, item) in points.iter().enumerate().skip(1)` or similar iterators, #[warn(needless_range_loop)] on by default
src/game/level.rs:285         for i in 1..points.len() {
                              ^
src/game/level.rs:285:9: 288:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
src/game/level.rs:303:9: 306:10 warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`, #[warn(single_match)] on by default
src/game/level.rs:303         match marker {
                              ^
src/game/level.rs:303:9: 306:10 help: try this
src/game/level.rs:            if let Marker::StartPos { player: 0 } = marker { *self.start_pos = pos + Vec3f::new(0.0, 0.5, 0.0) }
src/game/level.rs:303:9: 306:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#single_match
src/game/level.rs:324:19: 324:23 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:324             .push(&low, -half_width, 0.0, bounds.size[1], bounds, light_info)
                                        ^~~~
src/game/level.rs:324:19: 324:23 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:325:19: 325:23 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:325             .push(&low,
                                        ^~~~
src/game/level.rs:325:19: 325:23 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:331:19: 331:24 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:331             .push(&high, -half_width, 0.0, 0.0, bounds, light_info)
                                        ^~~~~
src/game/level.rs:331:19: 331:24 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:332:19: 332:23 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:332             .push(&low,
                                        ^~~~
src/game/level.rs:332:19: 332:23 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:338:19: 338:24 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:338             .push(&high, half_width, bounds.size[0], 0.0, bounds, light_info)
                                        ^~~~~
src/game/level.rs:338:19: 338:24 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/level.rs:339:19: 339:24 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/game/level.rs:339             .push(&high, -half_width, 0.0, 0.0, bounds, light_info);
                                        ^~~~~
src/game/level.rs:339:19: 339:24 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/game/lights.rs:8:5: 10:6 warning: you should consider deriving a `Default` implementation for `game::lights::LightBuffer`, #[warn(new_without_default_derive)] on by default
src/game/lights.rs:8     pub fn new() -> LightBuffer {
                         ^
src/game/lights.rs:8:5: 10:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/game/lights.rs:8:5: 10:6 help: try this
src/game/lights.rs:       #[derive(Default)]
src/game/game.rs:142:13: 142:82 warning: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`, #[warn(ok_expect)] on by default
src/game/game.rs:142             frame.finish().ok().expect("Cannot handle context loss currently :(");
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/game/game.rs:142:13: 142:82 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ok_expect
src/game/world.rs:19:5: 27:6 warning: you should consider deriving a `Default` implementation for `game::world::World`, #[warn(new_without_default_derive)] on by default
src/game/world.rs:19     pub fn new() -> World {
                         ^
src/game/world.rs:19:5: 27:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/game/world.rs:19:5: 27:6 help: try this
src/game/world.rs:       #[derive(Default)]
src/game/world.rs:116:35: 116:47 warning: using `clone` on a `Copy` type, #[warn(clone_on_copy)] on by default
src/game/world.rs:116         self.nodes.push(Node::new(line.clone()));
                                                        ^~~~~~~~~~~~
src/game/world.rs:116:35: 116:47 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#clone_on_copy
src/game/world.rs:122:35: 122:47 warning: using `clone` on a `Copy` type, #[warn(clone_on_copy)] on by default
src/game/world.rs:122         self.nodes.push(Node::new(line.clone()));
                                                        ^~~~~~~~~~~~
src/game/world.rs:122:35: 122:47 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#clone_on_copy
src/gfx/error.rs:34:53: 34:63 warning: this `match` has identical arm bodies, #[warn(match_same_arms)] on by default
src/gfx/error.rs:34             Error::IncompatibleOpenGl(ref inner) => &inner[..],
                                                                        ^~~~~~~~~~
src/gfx/error.rs:33:38: 33:48 note: same as this
src/gfx/error.rs:33             Error::Sdl(ref inner) => &inner[..],
                                                         ^~~~~~~~~~
src/gfx/error.rs:34:53: 34:63 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#match_same_arms
src/gfx/vertex.rs:32:5: 34:6 warning: you should consider deriving a `Default` implementation for `gfx::vertex::FlatBufferBuilder`, #[warn(new_without_default_derive)] on by default
src/gfx/vertex.rs:32     pub fn new() -> Self {
                         ^
src/gfx/vertex.rs:32:5: 34:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/gfx/vertex.rs:32:5: 34:6 help: try this
src/gfx/vertex.rs:       #[derive(Default)]
src/gfx/vertex.rs:58:5: 60:6 warning: you should consider deriving a `Default` implementation for `gfx::vertex::WallBufferBuilder`, #[warn(new_without_default_derive)] on by default
src/gfx/vertex.rs:58     pub fn new() -> Self {
                         ^
src/gfx/vertex.rs:58:5: 60:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/gfx/vertex.rs:58:5: 60:6 help: try this
src/gfx/vertex.rs:       #[derive(Default)]
src/gfx/vertex.rs:62:5: 82:6 warning: this function has too many arguments (8/7), #[warn(too_many_arguments)] on by default
src/gfx/vertex.rs:62     pub fn push(&mut self,
                         ^
src/gfx/vertex.rs:62:5: 82:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/gfx/vertex.rs:107:5: 109:6 warning: you should consider deriving a `Default` implementation for `gfx::vertex::DecorBufferBuilder`, #[warn(new_without_default_derive)] on by default
src/gfx/vertex.rs:107     pub fn new() -> Self {
                          ^
src/gfx/vertex.rs:107:5: 109:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/gfx/vertex.rs:107:5: 109:6 help: try this
src/gfx/vertex.rs:        #[derive(Default)]
src/gfx/vertex.rs:147:5: 149:6 warning: you should consider deriving a `Default` implementation for `gfx::vertex::SkyBufferBuilder`, #[warn(new_without_default_derive)] on by default
src/gfx/vertex.rs:147     pub fn new() -> Self {
                          ^
src/gfx/vertex.rs:147:5: 149:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#new_without_default_derive
src/gfx/vertex.rs:147:5: 149:6 help: try this
src/gfx/vertex.rs:        #[derive(Default)]
src/math/mat.rs:25:5: 31:6 warning: this function has too many arguments (16/7), #[warn(too_many_arguments)] on by default
src/math/mat.rs:25     pub fn new(m00: Scalar, m01: Scalar, m02: Scalar, m03: Scalar,
                       ^
src/math/mat.rs:25:5: 31:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/math/sphere.rs:68:9: 115:10 warning: the loop variable `i` is used to index `triangle`. Consider using `for (i, item) in triangle.iter().enumerate().take(3)` or similar iterators, #[warn(needless_range_loop)] on by default
src/math/sphere.rs:68         for i in 0..3 {
                              ^
src/math/sphere.rs:68:9: 115:10 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_range_loop
src/wad/name.rs:122:9: 122:80 warning: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`, #[warn(ok_expect)] on by default
src/wad/name.rs:122         str::from_utf8(self.deref()).ok().expect("wad name is not valid utf-8")
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wad/name.rs:122:9: 122:80 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ok_expect
src/wad/archive.rs:98:9: 98:45 warning: you seem to be using .map() to clone the contents of an Option, consider using `.cloned()`, #[warn(map_clone)] on by default
src/wad/archive.rs:98         self.index_map.get(name).map(|x| *x)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wad/archive.rs:98:9: 98:45 help: try
self.index_map.get(name).cloned()
src/wad/archive.rs:98:9: 98:45 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#map_clone
src/wad/archive.rs:105:9: 106:63 warning: use of `ok_or` followed by a function call, #[warn(or_fun_call)] on by default
src/wad/archive.rs:105         self.named_lump_index(name)
                               ^
src/wad/archive.rs:105:9: 106:63 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#or_fun_call
src/wad/archive.rs:105:9: 106:63 help: try this
src/wad/archive.rs:            self.named_lump_index(name).ok_or_else(|| MissingRequiredLump(format!("{:?}", name)))
src/wad/image.rs:292:9: 292:55 warning: use of `ok_or` followed by a function call, #[warn(or_fun_call)] on by default
src/wad/image.rs:292         self.ok_or(ImageError(Cow::Borrowed(message)))
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wad/image.rs:292:9: 292:55 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#or_fun_call
src/wad/image.rs:292:9: 292:55 help: try this
src/wad/image.rs:            self.ok_or_else(|| ImageError(Cow::Borrowed(message)))
src/wad/visitor.rs:14:5: 24:6 warning: this function has too many arguments (9/7), #[warn(too_many_arguments)] on by default
src/wad/visitor.rs:14     fn visit_wall_quad(&mut self,
                          ^
src/wad/visitor.rs:14:5: 24:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/wad/visitor.rs:14:5: 24:6 warning: this function has too many arguments (9/7), #[warn(too_many_arguments)] on by default
src/wad/visitor.rs:14     fn visit_wall_quad(&mut self,
                          ^
src/wad/visitor.rs:14:5: 24:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/wad/visitor.rs:157:40: 157:45 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/wad/visitor.rs:157         let partition = partition_line(&root);
                                                              ^~~~~
src/wad/visitor.rs:157:40: 157:45 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/wad/visitor.rs:180:40: 180:45 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/wad/visitor.rs:180         let partition = partition_line(&node);
                                                              ^~~~~
src/wad/visitor.rs:180:40: 180:45 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/wad/visitor.rs:373:31: 379:25 warning: this `else { if .. }` block can be collapsed, #[warn(collapsible_if)] on by default
src/wad/visitor.rs:373                        } else {
                                                     ^
src/wad/visitor.rs:373:31: 379:25 help: try
src/wad/visitor.rs:                           } else if is_untextured(&side.lower_texture) {
src/wad/visitor.rs:        Peg::BottomFloat
src/wad/visitor.rs:    } else {
src/wad/visitor.rs:        Peg::Top
src/wad/visitor.rs:    },
src/wad/visitor.rs:373:31: 379:25 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#collapsible_if
src/wad/visitor.rs:383:5: 478:6 warning: this function has too many arguments (8/7), #[warn(too_many_arguments)] on by default
src/wad/visitor.rs:383     fn wall_quad(&mut self,
                           ^
src/wad/visitor.rs:383:5: 478:6 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#too_many_arguments
src/wad/visitor.rs:429:60: 429:71 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/wad/visitor.rs:429         let light_info = light_info(&mut self.light_cache, &self.level, sector);
                                                                                  ^~~~~~~~~~~
src/wad/visitor.rs:429:60: 429:71 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/wad/visitor.rs:431:16: 431:30 warning: ==-comparison of f32 or f64 detected. Consider changing this to `(v1[0] - v2[0]).abs() < epsilon` for some suitable value of epsilon. std::f32::EPSILON and std::f64::EPSILON are available., #[warn(float_cmp)] on by default
src/wad/visitor.rs:431             if v1[0] == v2[0] {
                                      ^~~~~~~~~~~~~~
src/wad/visitor.rs:431:16: 431:30 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#float_cmp
src/wad/visitor.rs:434:23: 434:37 warning: ==-comparison of f32 or f64 detected. Consider changing this to `(v1[1] - v2[1]).abs() < epsilon` for some suitable value of epsilon. std::f32::EPSILON and std::f64::EPSILON are available., #[warn(float_cmp)] on by default
src/wad/visitor.rs:434             } else if v1[1] == v2[1] {
                                             ^~~~~~~~~~~~~~
src/wad/visitor.rs:434:23: 434:37 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#float_cmp
src/wad/visitor.rs:481:60: 481:71 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/wad/visitor.rs:481         let light_info = light_info(&mut self.light_cache, &self.level, sector);
                                                                                  ^~~~~~~~~~~
src/wad/visitor.rs:481:60: 481:71 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/wad/visitor.rs:645:68: 645:79 warning: this expression borrows a reference that is immediately dereferenced by the compiler, #[warn(needless_borrow)] on by default
src/wad/visitor.rs:645                                  light_info(&mut self.light_cache, &self.level, sector),
                                                                                          ^~~~~~~~~~~
src/wad/visitor.rs:645:68: 645:79 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#needless_borrow
src/wad/light.rs:32:16: 32:39 warning: ==-comparison of f32 or f64 detected. Consider changing this to `(alt_level - base_level).abs() < epsilon` for some suitable value of epsilon. std::f32::EPSILON and std::f64::EPSILON are available., #[warn(float_cmp)] on by default
src/wad/light.rs:32             if alt_level == base_level {
                                   ^~~~~~~~~~~~~~~~~~~~~~~
src/wad/light.rs:32:16: 32:39 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#float_cmp
src/wad/tex.rs:241:25: 241:94 warning: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`, #[warn(ok_expect)] on by default
src/wad/tex.rs:241         let mut atlas = Image::new(atlas_size[0], atlas_size[1]).ok().expect("atlas too big");
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wad/tex.rs:241:25: 241:94 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ok_expect
src/wad/tex.rs:392:27: 392:70 warning: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead, #[warn(option_map_unwrap_or)] on by default
src/wad/tex.rs:392         let first_frame = maybe_frames.map(|f| &f[0]).unwrap_or(name);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wad/tex.rs:392:27: 392:70 note: replace `map(|f| &f[0]).unwrap_or(name)` with `map_or(name, |f| &f[0])`
src/wad/tex.rs:392:27: 392:70 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or
src/main.rs:203:24: 206:69 warning: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead, #[warn(option_map_unwrap_or)] on by default
src/main.rs:203         let filename = Path::new(&args[0])
                                       ^
src/main.rs:203:24: 206:69 note: replace `map(|n| n.to_string_lossy()).unwrap_or(Cow::Borrowed("<cannot determine filename>"))` with `map_or(Cow::Borrowed("<cannot determine filename>"), |n| n.to_string_lossy())`
src/main.rs:203:24: 206:69 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or
src/main.rs:207:9: 209:50 warning: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`, #[warn(ok_expect)] on by default
src/main.rs:207         writeln!(io::stderr(), "{}: {}", filename, error)
                        ^
src/main.rs:207:9: 209:50 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#ok_expect

To get this output, I used:

  • rust nightly (1.11.0-nightly (ec872dc8a 2016-06-07)),
  • clippy version 0.75 (installed with cargo install clippy).

Then I ran cargo clippy on the root directory.

Note: Because of problems with the compilation of the dependencies, I had to cargo update the project.

Impossible to find -lSDL2 for /usr/bin/ld

Hi,

I've got a compilation error with the SDL2 library - i use ElementaryOS 0.3.1 and i've already install libsdl2-dev.

I've got this error when i try to build your work:

note: /usr/bin/ld: cannot find -lSDL2
/usr/bin/ld: cannot find -lSDL2
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile `rs_doom`.

Can anybody here explain to me what to do please?

I try to googling this thing but solutions doesn't work here... :-/

Thank you!

cargo crate registry error: 'SDL' linked with two different versions.

The whole message is (rust stable 1.5):

native library `SDL2` is being linked to by more than one package, and can only be linked to by one package

  sdl2-sys v0.7.0
  sdl2-sys v0.6.2

or (rust nightly 1.7):

native library `SDL2` is being linked to by more than one version of the same package, but it can only be linked once; try updating or pinning your dependencies to ensure that this package only shows up once

  sdl2-sys v0.7.0
  sdl2-sys v0.6.2

This can be reproduced by removing .cargo and rerunning cargo build on clean git tree. Then, the registry is updated, the crates are downloaded and then the message appears.

Compilation error in wad crate with rust 1.5 nightly

   Compiling wad v0.0.1 (file:///home/edward-san/doom-rust)
src/wad/image.rs:38:31: 38:33 error: unary negation of unsigned integers may be removed in the future
src/wad/image.rs:38         let mut pixels = vec![-1; width * height];
                                                  ^~
src/wad/image.rs:38:26: 38:50 note: in this expansion of vec! (defined in <std macros>)
src/wad/image.rs:38:31: 38:33 help: add #![feature(negate_unsigned)] to the crate attributes to enable
error: aborting due to previous error
Could not compile `wad`.

Note: in 1.4 beta, it gives the following message:

   Compiling wad v0.0.1 (file:///home/edward-san/doom-rust)
src/wad/image.rs:38:31: 38:33 warning: unary negation of unsigned integers will be feature gated in the future
src/wad/image.rs:38         let mut pixels = vec![-1; width * height];
                                                  ^~
src/wad/image.rs:38:26: 38:50 note: in this expansion of vec! (defined in <std macros>)

Cargo: Compilation warnings

See below:

   Compiling rs_doom v0.0.7 (file:///home/user/Git/rust-doom)
warning: unused import: `Float`, #[warn(unused_imports)] on by default
 --> src/game/player.rs:2:11
  |
2 | use num::{Float, Zero};
  |           ^^^^^

warning: unused import: `num::Float`, #[warn(unused_imports)] on by default
 --> src/math/mat.rs:1:5
  |
1 | use num::Float;
  |     ^^^^^^^^^^

warning: unused import: `Float`, #[warn(unused_imports)] on by default
 --> src/wad/tex.rs:3:11
  |
3 | use num::{Float, Zero};
  |           ^^^^^

warning: unused import: `ByteOrder`, #[warn(unused_imports)] on by default
 --> src/wad/read.rs:1:17
  |
1 | use byteorder::{ByteOrder, LittleEndian, ReadBytesExt};
  |                 ^^^^^^^^^

Edit: Fixed in c5fc783

Need to add "fake contrast"

Hi, I just checked out this project finally, and I'm impressed at how faithful it looks! But one thing I've noticed: in Doom, all walls that are perfectly "vertical" (constant x component) are effectively brightened by 16, and all walls that are horizontal (constant y component) are darkened by the same amount. This is especially obvious in a level like E2M2 (-iwad doom.wad -l 10) where the crate maze looks pretty blah without it.

"Could not create GL context" error on startup for GL 3.0

Since commit 65dbb73 , when I try to run rs_doom, compiled with nightly rustc (1.6.0-nightly (8ca0acc25 2015-10-28)), I get this message:

$ target/debug/rs_doom
rs_doom: graphics error: SDL: SDL error: Could not create GL context

I'm on Ubuntu 14.04 x86_64, running on this laptop with the following specs:

CPU: Intel Core i3-2328M
GPU: Intel Sandybridge Mobile

the mesa driver supports Opengl 3.0 and 3.1(core profile), if it might help.

Build fails on OS X 10.11.4

โžœ Source git:(preview) brew install sdl2_ttf
Warning: sdl2_ttf-2.0.14 already installed

note: ld: library not found for -lSDL2_ttf
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
error: Could not compile rs_doom.

โžœ Source git:(preview) rustc --version
rustc 1.8.0

Game Crash when hitting any key

I just compiled the game and when I hit a key the game crashes.

target/release/rs_doom --iwad doom1.wad
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:471
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at /checkout/src/libcore/panicking.rs:51
  10: sdl2::event::Event::from_ll
  11: <sdl2::event::EventPollIterator<'a> as core::iter::iterator::Iterator>::next
  12: rs_doom::game::game::Game::run
  13: rs_doom::main
  14: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  15: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  16: __libc_start_main
  17: _start
             at ../sysdeps/x86_64/start.S:120
plex@plex ~/code/rust-doom $ 

(edit by @cristicbz: added code fences for better formatting)

Err value: couldn't open file'

I'm getting this error now. I think it may have something to do with the WAD files, but I've made sure they are both a+rw accessible. I used both doom1 and doom2 WADs that have proper checksums.

doom1.wad: f0cefca49926d00903cf57551d901abe
Validated to: http://doomwiki.org/wiki/DOOM1.WAD

Command: ./rs-doom --iwad doom1.wad
OS: Jessie with Nvidia latest

Error:
task '

' failed at 'called Result::unwrap() on an Err value: couldn't open file', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/result.rs:808

GLSL version 300 not supported

Pulled your latest changes in master and am now getting shader compilation errors on OS X:

    task '<main>' failed at 'called `Result::unwrap()` on an `Err` value: Vertex shader compilation failed:
    ERROR: 0:1: '' :  version '300' is not supported
    ERROR: 0:1: '' : syntax error #version
    ERROR: 0:2: '' :  #version required and missing.
    ERROR: 0:4: '0' : syntax error syntax error
    ', /Users/jaymz/rust/src/libcore/result.rs:808

Add BSP specific visitor methods.

Something like bsp_partition(partition: &Line2f) and bsp_sibling() and bsp_partition_done(). This should also probably entail grouping Thing-s by subsector, which is not done in the WAD file.

Feature: "screenshot map" command

Not sure whether this is along the lines of where you want to take this project, but I've been wanting a proper tool for taking the kinds of level shots on this page:

http://ian-albert.com/games/doom_maps

(but for a program that's open source, actively maintained, more flexible, eventually works with vanilla PWADs etc)

Here's what it seems like such a command would entail:

  • use an ortho view projection instead of perspective
  • disable distance-diminished lighting (but still draw sector lighting)
  • zoom and position view to frame level extents + a margin
  • write screenshot to image at a resolution proportional to world scale (something like the maps linked above, ie larger maps result in larger images, up to a reasonable maximum) - not sure if this is easy to get to from a non-offline renderer like this one, though

Again, no idea if this is something you find interesting and/or want to do with this project, but I think lots of people in the Doom community would find this useful. Users could probably even rig it up into an auto-generated map generator for doomwiki + the idgames archive.

This project is really cool, keep up the good work!

Arm GLES / OpenGL 1.x compatibility

Any chance of having GLES rendering? Or just to test if the app's working, software OpenGL 2.0 using Mesa?

On older x86 hardware it would be useful to have OpenGL 1.x compatibilty which, in addition, would instantly enable those gles arm devices that get accelerated OpenGL 1.x through the glshim wrapper.

Small Doom Wiki Request

Hi, I found your project via the Reddit post, and I think it's super great! I've been involved with the Doom community for years, and I'm interested in Rust, so it's really cool to see both worlds come together.

The Doom community had something of a falling out with the Wikia people a while ago. I'm not trying to get you involved with our politics, but I wanted to tell you that we don't update the Doom Wiki on Wikia anymore, we use http://doomwiki.org. If you'd like, you can update your README.md, but don't at all feel pressured to. I just thought I'd ask for a favor, since we're trying to boost the Google rank of the new one.

Thanks, and keep up the good work :) !

Error on ubuntu 14.04 with the Rust nightly

Hi Cristi, sorry to bother but I'm having trouble using rust-doom so i thought to give you a feedback.

To give you some context I'm using a linux box with Ubuntu 14.04 and this kernel:

    Linux druzbox 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

libsdl2 is installed:

$ dpkg -l | grep libsdl2-dev
ii    libsdl2-dev    2.0.2+dfsg1-3ubuntu1.1    amd64    Simple DirectMedia Layer development files

The version of rust and cargo (both installed with rustup script) is:

$ rustc --version
rustc 0.13.0-nightly (adb44f53d 2014-10-12 00:07:15 +0000)
$ cargo --version
cargo 0.0.1-pre-nightly (5c5255f 2014-10-10 15:05:22 +0000)

When i run cargo test i get this output:

$ cargo test
   Compiling khronos_api v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
   Compiling rust-xml v0.1.0 (https://github.com/netvl/rust-xml#f86f02b3)
   Compiling sdl2 v0.0.1-alpha.1 (https://github.com/cristicbz/rust-sdl2?ref=static_to_const#c8c36cb6)
   Compiling toml v0.1.0 (https://github.com/alexcrichton/toml-rs#8a3ba4c6)
   Compiling gl_generator v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
   Compiling gl v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
   Compiling rs-doom v0.0.7 (file:///home/druznek/workspace/rust/rust-doom)
<std macros>:8:12: 95:21 error: cannot apply unary operator `!` to type `&'static str`
<std macros>:8         if !$cond {
<std macros>:9             fail!($($arg),+)
<std macros>:10         }
<std macros>:11     );
<std macros>:12 )
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/lib.rs:1


Could not compile `rs-doom`.

If i compile with cargo build --release it goes without errors and produce the rs-doom binary:

$ cargo build --release
Compiling toml v0.1.0 (https://github.com/alexcrichton/toml-rs#8a3ba4c6)
Compiling rust-xml v0.1.0 (https://github.com/netvl/rust-xml#f86f02b3)
Compiling sdl2 v0.0.1-alpha.1 (https://github.com/cristicbz/rust-sdl2?ref=static_to_const#c8c36cb6)
Compiling khronos_api v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Compiling gl_generator v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Compiling gl v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Compiling rs-doom v0.0.7 (file:///home/druznek/workspace/rust/rust-doom)

But when i launch it i get the following output:

$ ./target/release/rs-doom -i doom1.wad
task '<main>' failed at 'called `Result::unwrap()` on an `Err` value: Could not create GL context', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/result.rs:808

Sorry but I'm still not that fluent with rust to help you understand the issue, but i hope i helped you narrow it down (if it's a bug and not a problem of mine, of course).

Have a nice day! :)

Armv7 build fails

Even though I'm not on an accelerated OpenGL arm platform (just software Mesa 2.0) to actually test the final binary, I'd still like to be able to finish the build process.

Using rustc 1.5.0-dev (e518c057f 2015-10-23), I'm getting the following errors:

 Compiling backtrace v0.1.5
Running `rustc /home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/lib.rs --crate-name backtrace --crate-type lib -C opt-level=3 --cfg feature=\"dbghelp-sys\" --cfg feature=\"default\" --cfg feature=\"kernel32-sys\" --cfg feature=\"libunwind\" --cfg feature=\"dladdr\" --cfg feature=\"dbghelp\" --cfg feature=\"backtrace-sys\" --cfg feature=\"libbacktrace\" --cfg feature=\"winapi\" -C metadata=e4c0ebe143c52b5d -C extra-filename=-e4c0ebe143c52b5d --out-dir /tmp/rust-doom-master/target/release/deps --emit=dep-info,link -L dependency=/tmp/rust-doom-master/target/release/deps -L dependency=/tmp/rust-doom-master/target/release/deps --extern dbghelp=/tmp/rust-doom-master/target/release/deps/libdbghelp-040983399761f987.rlib --extern backtrace_sys=/tmp/rust-doom-master/target/release/deps/libbacktrace_sys-e659868d1ba4bec9.rlib --extern libc=/tmp/rust-doom-master/target/release/deps/liblibc-165b5479aec0459c.rlib --extern kernel32=/tmp/rust-doom-master/target/release/deps/libkernel32-c606ce60307b6481.rlib --extern debug_builders=/tmp/rust-doom-master/target/release/deps/libdebug_builders-4717471a4c16d259.rlib --extern winapi=/tmp/rust-doom-master/target/release/deps/libwinapi-3afcd2170e6034e1.rlib --extern cfg_if=/tmp/rust-doom-master/target/release/deps/libcfg_if-f8ac1d2a9eed8e25.rlib --cap-lints allow`
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158:29: 158:35 error: use of undeclared type name `c_uint` [E0412]
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158         type _Unwind_Word = c_uint;
                                                                                                                                        ^~~~~~
<cfg_if macros>:5:1: 6:79 note: in this expansion of __cfg_if_apply! (defined in <cfg_if macros>)
<cfg_if macros>:4:1: 6:29 note: in this expansion of __cfg_if_items! (defined in <cfg_if macros>)
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/mod.rs:79:1: 93:2 note: in this expansion of cfg_if! (defined in <cfg_if macros>)
/home/odroid/.cargo/registry/src/github.com-121aea75f9ef2ce2/backtrace-0.1.5/src/backtrace/libunwind.rs:158:29: 158:35 help: run `rustc --explain E0412` to see a detailed explanation
error: aborting due to previous error

Use of unstable library feature 'ord_max_min'

I cloned fresh and ran the command cargo build --release, but the console printed the following error messages:

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> engine/src/input.rs:259:61
    |
259 |         MouseButton::Other(index) => ((index + 4) as usize).min(NUM_MOUSE_BUTTONS - 1),
    |                                                             ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/level.rs:183:56
    |
183 |                     lowest_floor: heights.lowest_floor.min(floor),
    |                                                        ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/level.rs:184:58
    |
184 |                     highest_floor: heights.highest_floor.max(floor),
    |                                                          ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/level.rs:185:60
    |
185 |                     lowest_ceiling: heights.lowest_ceiling.min(ceiling),
    |                                                            ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/level.rs:186:62
    |
186 |                     highest_ceiling: heights.highest_ceiling.max(ceiling),
    |                                                              ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/level.rs:191:41
    |
191 |                         Some(next_floor.min(floor))
    |                                         ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> engine/src/text.rs:131:25
    |
131 |                 (left.0.max(right.0), left.1.max(right.1))
    |                         ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> engine/src/text.rs:131:46
    |
131 |                 (left.0.max(right.0), left.1.max(right.1))
    |                                              ^^^

error: aborting due to 3 previous errors

error: Could not compile `engine`.
warning: build failed, waiting for other jobs to finish...
error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/visitor.rs:252:42
    |
252 |                 Some((min, max)) => (min.min(coord), max.max(coord)),
    |                                          ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/visitor.rs:252:58
    |
252 |                 Some((min, max)) => (min.min(coord), max.max(coord)),
    |                                                          ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/visitor.rs:256:32
    |
256 |         .map(|(min, max)| (min.min(current), max.max(current)));
    |                                ^^^

error: use of unstable library feature 'ord_max_min' (see issue #25663)
   --> wad/src/visitor.rs:256:50
    |
256 |         .map(|(min, max)| (min.min(current), max.max(current)));
    |                                                  ^^^

error: aborting due to 9 previous errors

error: Could not compile `wad`.

To learn more, run the command again with --verbose.

My Rust version is rustc 1.20.0 (f3d6973f4 2017-08-27)

clippy warnings (more)

I noticed that if you run cargo clippy -- --all in the root directory of the project, you'll get warnings which wouldn't be visible otherwise.

There's a caveat, though: if you run the same command again later, it won't check again unless you make changes to the code or you clean/rebuild the project again. Maybe it's a clippy bug?

Here's a list of what it's shown right now (didn't check for false positives):

$ cargo clippy -- --all
   Compiling rs_doom v0.0.8 (file:///home/edward-san/rust-doom)
    Finished dev [unoptimized + debuginfo] target(s) in 20.36 secs
   Compiling engine v0.1.0 (file:///home/edward-san/rust-doom/engine)
warning: Constants have by default a `'static` lifetime
 --> engine/src/platform.rs:5:37
  |
5 |     pub const GLSL_VERSION_STRING: &'static str = "140";
  |                                     ^^^^^^^ help: consider removing `'static`
  |
  = note: #[warn(const_static_lifetime)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: Constants have by default a `'static` lifetime
   --> engine/src/text.rs:207:19
    |
207 | const FONT_PATH: &'static str = "assets/ttf/OpenSans-Regular.ttf";
    |                   ^^^^^^^ help: consider removing `'static`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: Constants have by default a `'static` lifetime
   --> engine/src/text.rs:212:20
    |
212 | const VERTEX_SRC: &'static str = r#"
    |                    ^^^^^^^ help: consider removing `'static`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: Constants have by default a `'static` lifetime
   --> engine/src/text.rs:223:22
    |
223 | const FRAGMENT_SRC: &'static str = r#"
    |                      ^^^^^^^ help: consider removing `'static`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: the function has a cyclomatic complexity of 35
   --> engine/src/entities.rs:210:5
    |
210 | /     fn update(&mut self, _dependencies: ()) {
211 | |         let Entities {
212 | |             ref mut removed,
213 | |             ref mut last_removed,
...   |
374 | |         removed.clear();
375 | |     }
    | |_____^
    |
    = note: #[warn(cyclomatic_complexity)] on by default
    = help: you could split it up into multiple smaller functions
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#cyclomatic_complexity

warning: length comparison to zero
   --> engine/src/materials.rs:174:12
    |
174 |         if self.map.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.map.is_empty()`
    |
    = note: #[warn(len_zero)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/meshes.rs:169:12
    |
169 |         if self.map.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.map.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
  --> engine/src/projections.rs:79:12
   |
79 |         if self.map.len() > 0 {
   |            ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.map.is_empty()`
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: this expression borrows a reference that is immediately dereferenced by the compiler
   --> engine/src/renderer.rs:190:50
    |
190 |                 Mat4::from(view_transform.concat(&model_transform))
    |                                                  ^^^^^^^^^^^^^^^^ help: change this to: `model_transform`
    |
    = note: #[warn(needless_borrow)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#needless_borrow

warning: this let-binding has unit value. Consider omitting `let _ =`
   --> engine/src/renderer.rs:238:9
    |
238 |         let _ = deps.entities.remove(self.entity);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(let_unit_value)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#let_unit_value

warning: length comparison to zero
   --> engine/src/shaders.rs:124:12
    |
124 |         if self.map.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.map.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/text.rs:174:12
    |
174 |         if self.slab.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.slab.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/transforms.rs:153:12
    |
153 |         if self.map.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.map.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/uniforms.rs:406:12
    |
406 |         if self.texture2ds.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.texture2ds.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/uniforms.rs:413:12
    |
413 |         if self.floats.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.floats.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/uniforms.rs:417:12
    |
417 |         if self.buffer_textures_u8.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.buffer_textures_u8.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/uniforms.rs:424:12
    |
424 |         if self.mat4s.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.mat4s.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

warning: length comparison to zero
   --> engine/src/uniforms.rs:428:12
    |
428 |         if self.vec2fs.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is more concise: `!self.vec2fs.is_empty()`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#len_zero

    Finished dev [unoptimized + debuginfo] target(s) in 30.33 secs
   Compiling math v0.1.0 (file:///home/edward-san/rust-doom/math)
    Finished dev [unoptimized + debuginfo] target(s) in 2.27 secs
   Compiling game v0.1.0 (file:///home/edward-san/rust-doom/game)
warning: Constants have by default a `'static` lifetime
   --> game/src/hud.rs:148:21
    |
148 | const PROMPT_TEXT: &'static str = "WASD and mouse, 'E' to push/use, LB to shoot or 'h' for help.";
    |                     ^^^^^^^ help: consider removing `'static`
    |
    = note: #[warn(const_static_lifetime)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: Constants have by default a `'static` lifetime
   --> game/src/hud.rs:149:19
    |
149 | const HELP_TEXT: &'static str = r"Use WASD to move and the mouse or arrow keys to aim.
    |                   ^^^^^^^ help: consider removing `'static`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: Constants have by default a `'static` lifetime
  --> game/src/lib.rs:39:25
   |
39 | pub const SHADER_ROOT: &'static str = "assets/shaders";
   |                         ^^^^^^^ help: consider removing `'static`
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#const_static_lifetime

warning: strict comparison of f32 or f64
   --> game/src/level.rs:210:20
    |
210 |                 if effect.first_height_offset != *current_offset {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(effect.first_height_offset - *current_offset).abs() < error`
    |
    = note: #[warn(float_cmp)] on by default
note: std::f32::EPSILON and std::f64::EPSILON are available.
   --> game/src/level.rs:210:20
    |
210 |                 if effect.first_height_offset != *current_offset {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#float_cmp

warning: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
   --> game/src/level.rs:250:27
    |
250 |         for &i_removed in self.removed.iter() {
    |                           ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&self.removed`
    |
    = note: #[warn(explicit_iter_loop)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#explicit_iter_loop

warning: this let-binding has unit value. Consider omitting `let _ =`
   --> game/src/level.rs:269:9
    |
269 |         let _ = deps.entities.remove(self.root);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(let_unit_value)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#let_unit_value

warning: manual implementation of an assign operation
   --> game/src/player.rs:149:21
    |
149 |                     head.center = head.center + displacement;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `head.center += displacement`
    |
    = note: #[warn(assign_op_pattern)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:150:21
    |
150 | /                     self.velocity = self.velocity -
151 | |                         contact.normal * contact.normal.dot(self.velocity);
    | |__________________________________________________________________________^ help: replace it with: `self.velocity -= contact.normal * contact.normal.dot(self.velocity)`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:156:13
    |
156 |             head.center = head.center + displacement;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `head.center += displacement`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:168:9
    |
168 |         head.center = head.center + self.velocity * delta_time;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `head.center += self.velocity * delta_time`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:224:13
    |
224 |             movement = movement * config.move_force;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `movement *= config.move_force`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:285:13
    |
285 |             slowdown = slowdown - self.velocity * config.air_drag * speed;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `slowdown -= self.velocity * config.air_drag * speed`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:293:17
    |
293 |                 force = force + slowdown;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `force += slowdown`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: manual implementation of an assign operation
   --> game/src/player.rs:387:9
    |
387 |         self.velocity = self.velocity + force * delta_time;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.velocity += force * delta_time`
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

warning: this expression borrows a reference that is immediately dereferenced by the compiler
   --> game/src/player.rs:390:13
    |
390 |             &transform,
    |             ^^^^^^^^^^ help: change this to: `transform`
    |
    = note: #[warn(needless_borrow)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#needless_borrow

warning: this let-binding has unit value. Consider omitting `let _ =`
   --> game/src/player.rs:403:9
    |
403 |         let _ = deps.entities.remove(self.id);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#let_unit_value

warning: this lifetime isn't used in the function definition
   --> game/src/game_shaders.rs:384:25
    |
384 |     fn load_wad_texture<'b>(
    |                         ^^
    |
    = note: #[warn(unused_lifetimes)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#unused_lifetimes

    Finished dev [unoptimized + debuginfo] target(s) in 60.49 secs
   Compiling log v0.3.8
   Compiling wad v0.1.0 (file:///home/edward-san/rust-doom/wad)
warning: methods called `to_*` usually take self by reference; consider choosing a less ambiguous name
   --> wad/src/visitor.rs:292:9
    |
292 |         this: Option<Self>,
    |         ^^^^
    |
    = note: #[warn(wrong_self_convention)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#wrong_self_convention

warning: this expression borrows a reference that is immediately dereferenced by the compiler
   --> wad/src/visitor.rs:403:29
    |
403 |                             &level,
    |                             ^^^^^^ help: change this to: `level`
    |
    = note: #[warn(needless_borrow)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#needless_borrow

warning: manual implementation of an assign operation
    --> wad/src/visitor.rs:1291:9
     |
1291 |         *point = *point + (*point - center).normalize_or_zero() * POLY_BIAS;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `*point += (*point - center).normalize_or_zero() * POLY_BIAS`
     |
     = note: #[warn(assign_op_pattern)] on by default
     = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.168/index.html#assign_op_pattern

    Finished dev [unoptimized + debuginfo] target(s) in 60.98 secs

SIGABRT when using Wayland

To reproduce, just use Wayland, build rust-doom, and run it. It works fine if I set WAYLAND_DISPLAY=''. I've ran cargo update and rebuilt, too, but it didn't change anything.

Keyboard input does not work on Mac

I'm able to build rust-doom fine on my Mac. However, the keyboard shortcuts (w, a, s, d, f, h, esc, ...) do not work.

$ rustc --version                                             master
rustc 1.36.0
$ sw_vers                                                     master
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G87

There is a similar issue about the mouse not working on Mac. The trackpad or and external mouse do not work for me.

Illegal hardware instruction

The engine crashes with the following message: zsh: illegal hardware instruction (core dumped).
I used rust version 1.27.0 (3eda71b00 2018-06-19) as well as rustc 1.29.0-nightly (9fd3d7899 2018-07-07) to build a binary but both show the same error message.

$ strace target/release/rs_doom --iwad ~/.doomwads/DOOM2.WAD
execve("target/release/rs_doom", ["target/release/rs_doom", "--iwad", "/home/alinz/.doomwads/DOOM2.WAD"], 0x7ffc61e56e10 /* 61 vars */) = 0
brk(NULL)                               = 0x55eb88498000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4366000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=14144, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa9c4364000
mmap(NULL, 2109584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c3f7b000
mprotect(0x7fa9c3f7e000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c417d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fa9c417d000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\36\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=30912, ...}) = 0
mmap(NULL, 2128376, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c3d73000
mprotect(0x7fa9c3d7a000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c3f79000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fa9c3f79000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 ]\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146664, ...}) = 0
mmap(NULL, 2216504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c3b55000
mprotect(0x7fa9c3b6e000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c3d6d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fa9c3d6d000
mmap(0x7fa9c3d6f000, 12856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fa9c3d6f000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0(\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=863176, ...}) = 0
mmap(NULL, 2192112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c393d000
mprotect(0x7fa9c3954000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c3b53000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fa9c3b53000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2001\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2105608, ...}) = 0
mmap(NULL, 3914128, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c3581000
mprotect(0x7fa9c3734000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c3933000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b2000) = 0x7fa9c3933000
mmap(0x7fa9c3939000, 14736, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fa9c3939000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\267\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1656648, ...}) = 0
mmap(NULL, 3751960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c31ec000
mprotect(0x7fa9c337f000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c357f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x193000) = 0x7fa9c357f000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa9c4362000
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa9c435f000
arch_prctl(ARCH_SET_FS, 0x7fa9c435f880) = 0
mprotect(0x7fa9c3933000, 16384, PROT_READ) = 0
mprotect(0x7fa9c357f000, 4096, PROT_READ) = 0
mprotect(0x7fa9c3b53000, 4096, PROT_READ) = 0
mprotect(0x7fa9c3d6d000, 4096, PROT_READ) = 0
mprotect(0x7fa9c3f79000, 4096, PROT_READ) = 0
mprotect(0x7fa9c417d000, 4096, PROT_READ) = 0
mprotect(0x55eb86678000, 90112, PROT_READ) = 0
mprotect(0x7fa9c43a3000, 4096, PROT_READ) = 0
munmap(0x7fa9c4366000, 248277)          = 0
set_tid_address(0x7fa9c435fb50)         = 32512
set_robust_list(0x7fa9c435fb60, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7fa9c3b5a790, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fa9c3b66a80}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7fa9c3b5a830, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fa9c3b66a80}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlink("/etc/malloc.conf", 0x7ffcfbff5b50, 4096) = -1 ENOENT (No such file or directory)
open("/proc/sys/vm/overcommit_memory", O_RDONLY) = 3
read(3, "0", 1)                         = 1
close(3)                                = 0
brk(NULL)                               = 0x55eb88498000
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fa9c2fec000
munmap(0x7fa9c2fec000, 2097152)         = 0
mmap(NULL, 4190208, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fa9c2ded000
munmap(0x7fa9c2ded000, 77824)           = 0
munmap(0x7fa9c3000000, 2015232)         = 0
openat(AT_FDCWD, "/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 3
read(3, "0-11\n", 8192)                 = 5
close(3)                                = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fa9c35b78f0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fa9c2c00000
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "55eb8601e000-55eb86478000 r-xp 0"..., 1024) = 1024
read(3, "libc-2.27.so\n7fa9c3933000-7fa9c3"..., 1024) = 1024
read(3, "pthread-2.27.so\n7fa9c3d6f000-7fa"..., 1024) = 1024
read(3, "4135                    /usr/lib"..., 1024) = 427
close(3)                                = 0
sched_getaffinity(32512, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) = 32
rt_sigaction(SIGSEGV, {sa_handler=0x55eb8632b4c0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fa9c3b66a80}, NULL, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x55eb8632b4c0, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fa9c3b66a80}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa9c43a1000
sigaltstack({ss_sp=0x7fa9c43a1000, ss_flags=0, ss_size=8192}, NULL) = 0
getrandom("", 0, GRND_NONBLOCK)         = 0
getrandom("\xad\x61\x59\xd1\x83\x28\x4b\x05\xaf\x72\x2b\x9d\x4b\xfc\x14\xe1", 16, GRND_NONBLOCK) = 16
getrandom("", 0, 0)                     = 0
getrandom("\xa8\x7e\xb1\xbc\xb7\x25\x0a\x51\xf9\x69\x70\x7e\x99\xde\x10\x53\x38\x26\xb8\xbf\xf5\x26\xae\x2a\x1e\xd2\xa2\xe9\x84\xc3\x7e\x85"..., 2048, 0) = 2048
futex(0x7fa9c417e048, FUTEX_WAKE_PRIVATE, 2147483647) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libwayland-client.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pP\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=59848, ...}) = 0
mmap(NULL, 2155304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c29f1000
mprotect(0x7fa9c29fe000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c2bfd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7fa9c2bfd000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libffi.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\32\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=35280, ...}) = 0
mmap(NULL, 2131560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c27e8000
mprotect(0x7fa9c27ef000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c29ef000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fa9c29ef000
close(3)                                = 0
mprotect(0x7fa9c29ef000, 4096, PROT_READ) = 0
mprotect(0x7fa9c2bfd000, 8192, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-0"}, 27) = -1 ENOENT (No such file or directory)
close(3)                                = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libX11.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\333\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1306096, ...}) = 0
mmap(NULL, 3403064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c24a9000
mprotect(0x7fa9c25e2000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c27e2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x139000) = 0x7fa9c27e2000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libxcb.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\273\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=166888, ...}) = 0
mmap(NULL, 2261256, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c2280000
mprotect(0x7fa9c22a7000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c24a7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x27000) = 0x7fa9c24a7000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXau.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\f\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=15224, ...}) = 0
mmap(NULL, 2109480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c207c000
mprotect(0x7fa9c207e000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c227e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fa9c227e000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXdmcp.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=22120, ...}) = 0
mmap(NULL, 2117648, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c1e76000
mprotect(0x7fa9c1e7b000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c207a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7fa9c207a000
close(3)                                = 0
mprotect(0x7fa9c207a000, 4096, PROT_READ) = 0
mprotect(0x7fa9c227e000, 4096, PROT_READ) = 0
mprotect(0x7fa9c24a7000, 4096, PROT_READ) = 0
mprotect(0x7fa9c27e2000, 4096, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXcursor.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240$\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=38512, ...}) = 0
mmap(NULL, 2134056, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c1c6c000
mprotect(0x7fa9c1c75000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c1e74000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7fa9c1e74000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXrender.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\33\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=43544, ...}) = 0
mmap(NULL, 2138760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c1a61000
mprotect(0x7fa9c1a6a000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c1c6a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7fa9c1c6a000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXfixes.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\24\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=23328, ...}) = 0
mmap(NULL, 2117688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c185b000
mprotect(0x7fa9c1860000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c1a5f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7fa9c1a5f000
close(3)                                = 0
mprotect(0x7fa9c1a5f000, 4096, PROT_READ) = 0
mprotect(0x7fa9c1c6a000, 4096, PROT_READ) = 0
mprotect(0x7fa9c1e74000, 4096, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXrandr.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\33\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=43984, ...}) = 0
mmap(NULL, 2138280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c1650000
mprotect(0x7fa9c165a000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c1859000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7fa9c1859000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXext.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 5\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=72576, ...}) = 0
mmap(NULL, 2168632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c143e000
mprotect(0x7fa9c144f000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c164e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7fa9c164e000
close(3)                                = 0
mprotect(0x7fa9c164e000, 4096, PROT_READ) = 0
mprotect(0x7fa9c1859000, 4096, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libXi.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200#\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=68040, ...}) = 0
mmap(NULL, 2163368, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c122d000
mprotect(0x7fa9c123c000, 2097152, PROT_NONE) = 0
mmap(0x7fa9c143c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x7fa9c143c000
close(3)                                = 0
mprotect(0x7fa9c143c000, 4096, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=248277, ...}) = 0
mmap(NULL, 248277, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa9c4322000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libX11-xcb.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\5\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=5968, ...}) = 0
mmap(NULL, 2101288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa9c102b000
mprotect(0x7fa9c102c000, 2093056, PROT_NONE) = 0
mmap(0x7fa9c122b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7fa9c122b000
close(3)                                = 0
mprotect(0x7fa9c122b000, 4096, PROT_READ) = 0
munmap(0x7fa9c4322000, 248277)          = 0
--- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0x55eb86239bab} ---
+++ killed by SIGILL (core dumped) +++

Windows: Couldn't build on Windows 8 (gl-rs build fails)

I don't often build anything with rust, so maybe I'm doing something wrong.

yuv@YUV13 /E/Games/rust-doom (master)
$ cargo build --release --verbose
Fresh rust-xml v0.1.0 (https://github.com/netvl/rust-xml#f86f02b3)
Fresh toml v0.1.0 (https://github.com/alexcrichton/toml-rs#8a3ba4c6)
Fresh sdl2 v0.0.1-alpha.1 (https://github.com/cristicbz/rust-sdl2?ref=sta
tic_to_const#c8c36cb6)
Fresh khronos_api v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Compiling gl_generator v0.0.1 (https://github.com/bjz/gl-rs#feed7be3)
Running rustc lib.rs --crate-name gl_generator --crate-type dylib --opt-le vel 3 --cfg ndebug -C metadata=cda8351b0c2935af -C extra-filename=-cda8351b0c293 5af --out-dir E:\Games\rust-doom\target\release\deps --dep-info E:\Games\rust-do om\target\release\.fingerprint\gl_generator-cda8351b0c2935af\dep-lib-gl_generato r -L E:\Games\rust-doom\target\release\deps -L E:\Games\rust-doom\target\release \deps --extern xml=E:\Games\rust-doom\target\release\deps/libxml-759dae9327f1df3 d.rlib --extern khronos_api=E:\Games\rust-doom\target\release\deps/libkhronos_ap i-76f01477ab0f76eb.rlib
error: linking with gcc failed: exit code: 1
note: gcc '-m64' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw3
2\lib' '-o' 'E:\Games\rust-doom\target\release\deps\gl_generator-cda8351b0c2935a
f.dll' 'E:\Games\rust-doom\target\release\deps\gl_generator-cda8351b0c2935af.o'
'-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive' 'E:\Games\rust-doom
\target\release\deps\gl_generator-cda8351b0c2935af.metadata.o' '-fno-lto' '-fno-
use-linker-plugin' '-static-libgcc' '-Wl,--enable-long-section-names' '-Wl,--nxc
ompat' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-l
rustc-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32
\lib' '-lflate-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w6
4-mingw32\lib' '-lgetopts-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustli
b\x86_64-w64-mingw32\lib' '-lrbml-4e7c5e5c' 'E:\Games\rust-doom\target\release\d
eps\libkhronos_api-76f01477ab0f76eb.rlib' '-L' 'C:\Program Files (x86)\Rust\bin
rustlib\x86_64-w64-mingw32\lib' '-lrustc_llvm-4e7c5e5c' 'E:\Games\rust-doom\targ
et\release\deps\libxml-759dae9327f1df3d.rlib' '-L' 'C:\Program Files (x86)\Rust
bin\rustlib\x86_64-w64-mingw32\lib' '-ltime-4e7c5e5c' '-L' 'C:\Program Files (x8
6)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lgraphviz-4e7c5e5c' '-L' 'C:\Progr
am Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lrustc_back-4e7c5e5c'
'-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lsyntax-
4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib'
'-lfmt_macros-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64
-mingw32\lib' '-larena-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x
86_64-w64-mingw32\lib' '-lserialize-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust
bin\rustlib\x86_64-w64-mingw32\lib' '-ldebug-4e7c5e5c' '-L' 'C:\Program Files (x
86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lterm-4e7c5e5c' '-L' 'C:\Program
Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-llog-4e7c5e5c' '-L' 'C:\P
rogram Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lregex-4e7c5e5c' '
-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-lstd-4e7c
5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\lib' '-ls
ync-4e7c5e5c' '-L' 'C:\Program Files (x86)\Rust\bin\rustlib\x86_64-w64-mingw32\l
ib' '-lrustrt-4e7c5e5c' '-L' 'E:\Games\rust-doom\target\release\deps' '-L' 'E:\G
ames\rust-doom\target\release\deps' '-L' 'C:\Users\yuv.cargo\git\checkouts\gl-r
s-5020f97825182d66\master\src\gl_generator.rust' '-L' 'C:\Users\yuv.cargo\git
checkouts\gl-rs-5020f97825182d66\master\src\gl_generator' '-Wl,--whole-archive'
'-Wl,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic' '-lshell32' '-lpsapi' '-
limagehlp' '-lm' '-lstdc++' '-lkernel32' '-shared' '-lcompiler-rt'
note: E:\Games\rust-doom\target\release\deps\gl_generator-cda8351b0c2935af.o: fi
le not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile gl_generator.

Caused by:
Process didn't exit successfully: rustc lib.rs --crate-name gl_generator --cr ate-type dylib --opt-level 3 --cfg ndebug -C metadata=cda8351b0c2935af -C extra- filename=-cda8351b0c2935af --out-dir E:\Games\rust-doom\target\release\deps --de p-info E:\Games\rust-doom\target\release\.fingerprint\gl_generator-cda8351b0c293 5af\dep-lib-gl_generator -L E:\Games\rust-doom\target\release\deps -L E:\Games\r ust-doom\target\release\deps --extern xml=E:\Games\rust-doom\target\release\deps /libxml-759dae9327f1df3d.rlib --extern khronos_api=E:\Games\rust-doom\target\rel ease\deps/libkhronos_api-76f01477ab0f76eb.rlib -Awarnings (status=101)

Signed distance of Line2

Analyzing different sources (wiki and wolfram math docs) I get information that signed distance is calculated as n cross (point - origin) and that conflicts with code implemented here:

to.to_vec().perp_dot(self.displace) + self.displace.perp_dot(self.origin.to_vec())

The question is this right or should be written as:
to.to_vec().perp_dot(self.displace) - self.origin.perp_dot(self.displace.to_vec())

Should font be local?

I'm using Windows and ran into this when running .\rs_doom.exe --iwad "C:\Program Files (x86)\Steam\steamapps\common\Ultimate Doom\base\DOOM.WAD" in <project root>\target\debug\release:

[ERROR rs_doom] Fatal error: Game error: during setup
[ERROR rs_doom]     caused by: System creation failed for `text_renderer`.
[ERROR rs_doom]     caused by: Font error: Cannot read font at assets/ttf/OpenSans-Regular.ttf
[ERROR rs_doom]     caused by: The system cannot find the path specified. (os error 3)
[ERROR rs_doom] Run with RUST_BACKTRACE=1 to capture backtrace.

It works fine if I use target\debug\release\rs_doom.exe, but should it be using local paths for the font? Ideally it should use a font on the user's system

Re-reform Vector types

Some time ago I decided that it would be a good idea to reform the vector types but it turns out that wasn't such a great idea after all. It might make type system geeks like me happy, but it doesn't buy much in terms of flexibility and it drastically harms readability and compile times.

To cut on repetition it would probably be a good idea to use a macro instead of the type system shenanigans.

A different but also good idea would be to add operator overloading on reference types in addition to values, to cut on asterisks and ampersand in the sphere code.

Vertex shader compilation failed

You're probably tired of me by now, but I'm determined to get this thing working (for the love of Rust).

rust-doom$ RUST_LOG=info RUST_BACKTRACE=1 target/rs-doom --iwad doom1.wad
INFO:rs-doom::wad::archive: Loading wad file 'doom1.wad'...
INFO:rs-doom::wad::tex: Reading texture directory...
INFO:rs-doom::wad::tex: 14 palettes
INFO:rs-doom::wad::tex: 34 colormaps
INFO:rs-doom::wad::tex: Reading 350 patches....
WARN:rs-doom::wad::tex: Done in 0.0577s; 187 missing patches.
INFO:rs-doom::wad::tex: 350 patches
INFO:rs-doom::wad::tex: Reading & assembling textures...
INFO:rs-doom::wad::tex: 125 textures in TEXTURE1
INFO:rs-doom::wad::tex: 0 textures in TEXTURE2
INFO:rs-doom::wad::tex: Done in 0.0612s.
INFO:rs-doom::wad::tex: 54 flats
INFO:rs-doom::level: Building level E1M1...
INFO:rs-doom::wad::level: Reading level data for 'E1M1'...
INFO:rs-doom::wad::level: Loaded level 'E1M1':
INFO:rs-doom::wad::level: 138 things
INFO:rs-doom::wad::level: 475 linedefs
INFO:rs-doom::wad::level: 648 sidedefs
INFO:rs-doom::wad::level: 467 vertices
INFO:rs-doom::wad::level: 732 segs
INFO:rs-doom::wad::level: 237 subsectors
INFO:rs-doom::wad::level: 236 nodes
INFO:rs-doom::wad::level: 85 sectors
INFO:rs-doom::shader: Reading shaders from src/shaders/sky.vert src/shaders/sky.frag...
task '

' failed at 'called Result::unwrap() on an Err value: Vertex shader compilation failed:
0(3) : error C0000: syntax error, unexpected '(', expecting "::" at token "("
0(5) : warning C7022: unrecognized profile specifier "flat"
0(5) : error C0502: syntax error at token "flat"
0(5) : error C5060: out can't be used with non-varying v_r
0(6) : error C5060: out can't be used with non-varying v_p
', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/result.rs:808
stack backtrace:
1: 0x7fe8bca7b7e0 - rt::backtrace::imp::write::hdbb48f4c53a7cc60gDq
2: 0x7fe8bca7e770 - failure::on_fail::h664e14eeb2ff8c0bDYq
3: 0x7fe8bca8d720 - unwind::begin_unwind_inner::h46eb6d3df9093f27Gxd
4: 0x7fe8bca8d260 - unwind::begin_unwind_fmt::h39c3423b9e1f02ab8ud
5: 0x7fe8bca8d220 - rust_begin_unwind
6: 0x7fe8bcac2f80 - failure::fail_fmt::hb781b41de6c01533iqk
7: 0x7fe8bc9a0710 - result::Result<T, E>::unwrap::h14302133677336241223
8: 0x7fe8bc99d4f0 - level::init_sky_step::haedb4cbd83255db11NC
9: 0x7fe8bc999d20 - level::build_level::hb93d5ecf6a510bbdSHC
10: 0x7fe8bc999c00 - level::Level::new::h532b2db11d1e32524EC
11: 0x7fe8bc9ca6a0 - Game::new::hfbbbccc1064d761aLsE
12: 0x7fe8bc9cc8c0 - main::he89110b84eb07809BBE
13: 0x7fe8bca2c750 - start::closure.8522
14: 0x7fe8bca8e2e0 - rust_try_inner
15: 0x7fe8bca8e2d0 - rust_try
16: 0x7fe8bca8bb80 - unwind::try::h3d43641284f9183bomd
17: 0x7fe8bca8ba10 - task::Task::run::h280134ab570169c32Bc
18: 0x7fe8bca2c470 - start::h6fd65e736c2637fdIhe
19: 0x7fe8bca2c3d0 - lang_start::h9c26c012b0091d5b1ge
20: 0x7fe8bc9ce590 - main
21: 0x7fe8bb7dea50 - __libc_start_main
22: 0x7fe8bc8e4f9f -
23: 0x0 -

Linux: Failed to build in Arch Linux

I am fairly new to building in rust / cargo, so i don't know if I have done something wrong, but when i run cargo build --release I get an errer message saying "unresolved import std::eroor::Error. Could not find error in std.
I don't know if I am running the wrong version of rust or something, but there are other unresolved imports further down.
The full log looks like this:

[havard@ARCH_USB rust-doom-master]$ cargo build --release
    Updating git repository `https://github.com/AngryLawyer/rust-sdl2`
    Updating git repository `https://github.com/bjz/gl-rs`
    Updating git repository `https://github.com/netvl/rust-xml`
    Updating git repository `https://github.com/alexcrichton/toml-rs`
   Compiling sdl2 v0.0.1-alpha.1 (https://github.com/AngryLawyer/rust-sdl2#93cc0d41)
   Compiling toml v0.1.0 (https://github.com/alexcrichton/toml-rs#796a127a)
   Compiling gl_common v0.0.1 (https://github.com/bjz/gl-rs#79cd3b3f)
   Compiling khronos_api v0.0.1 (https://github.com/bjz/gl-rs#79cd3b3f)
   Compiling base v0.0.1 (file:///home/havard/Dokument/rust/rust-doom-master)
   Compiling rust-xml v0.1.0 (https://github.com/netvl/rust-xml#d6c57380)
   Compiling math v0.0.1 (file:///home/havard/Dokument/rust/rust-doom-master)
/home/havard/.cargo/git/checkouts/toml-rs-73fb57c92ca3f82c/master/src/parser.rs:3:5: 3:22 error: unresolved import `std::error::Error`. Could not find `error` in `std`.
/home/havard/.cargo/git/checkouts/toml-rs-73fb57c92ca3f82c/master/src/parser.rs:3 use std::error::Error;
                                                                                      ^~~~~~~~~~~~~~~~~
/home/havard/.cargo/git/checkouts/toml-rs-73fb57c92ca3f82c/master/src/serialization.rs:4:5: 4:34 error: unresolved import `std::error::Error`. Could not find `error` in `std`.
/home/havard/.cargo/git/checkouts/toml-rs-73fb57c92ca3f82c/master/src/serialization.rs:4 use std::error::Error as StdError;
                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Build failed, waiting for other jobs to finish...
src/namespace.rs:3:34: 3:41 error: unresolved import `std::collections::hash_map::HashMap`. Could not find `hash_map` in `std::collections`.
src/namespace.rs:3 use std::collections::hash_map::{HashMap, Entries};
                                                    ^~~~~~~
src/namespace.rs:3:43: 3:50 error: unresolved import `std::collections::hash_map::Entries`. Could not find `hash_map` in `std::collections`.
src/namespace.rs:3 use std::collections::hash_map::{HashMap, Entries};
                                                             ^~~~~~~
error: aborting due to 2 previous errors
Could not compile `toml`.

To learn more, run the command again with --verbose.

Mark `Id` as thread-safe

Suggestion:
Change the implementation of Id<T> to hold a marker of type PhantomData<*const T> instead of PhantomData<T>, and to manually implement Send + Sync for Id<T>.

Rationale:
Ultimately, Id<T> semantically behaves just like an index into some storage to retrieve an object of type T. In this regard, passing around an Id<T> should be no different than passing around a usize.

However, because Id<T> uses PhantomData<T>, the Rust compiler thinks that Id<T> actually owns an object of type T, thus imposing the same thread-safety restrictions on Id<T>, as if it actually held T.

I believe, this is semantically not correct, and in this case, Id could be marked as Send + Sync regardless of the type of data it references, in addition to changing the definition inside Id<T> from PhantomData<T> to PhantomData<*const T> to relieve Id<T> from having to obey by the lifetime restrictions of T.

Here is the relevant excerpt from the Rust docs on this practice:

If your struct does not in fact own the data of type T, it is better to use a reference type, like PhantomData<&'a T> (ideally) or PhantomData<*const T> (if no lifetime applies), so as not to indicate ownership.

Use cases:
This is especially useful if you want a handle to data that is stored in some system somewhere that isn't Send or Sync, or has certain lifetime restrictions considerably complicating the API.

I believe it is appropriate to do so, because you cannot acquire an object of type T using just the Id<T>, you also need the relevant IdMap or IdSlab, which would in turn impose the correct lifetime and thread-safety restrictions upon trying to retrieve the actual object.

Ultimately, this would allow other systems (and threads!) to hold reference to data of the relevant system, without being burdened by the lifetimes and thread-safety restrictions of the original type.

Please, correct me if my reasoning is wrong and if it could potentially introduce UB into the code. Otherwise, this should be a very simple change and should not break any backwards compatibility (I have used rust-doom as an example to verify that).

I can open a PR with the change if you approve of the concept.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.