diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/render-bsp/data/newtest.bsp | bin | 66488 -> 0 bytes | |||
-rw-r--r-- | examples/render-bsp/data/newtest.map | 110 | ||||
-rw-r--r-- | examples/render-bsp/data/test.bsp | bin | 63640 -> 0 bytes | |||
-rw-r--r-- | examples/render-bsp/data/test.map | 116 | ||||
-rw-r--r-- | examples/render-quad/Cargo.toml (renamed from examples/render-bsp/Cargo.toml) | 2 | ||||
-rw-r--r-- | examples/render-quad/src/level.rs | 78 | ||||
-rw-r--r-- | examples/render-quad/src/main.rs (renamed from examples/render-bsp/src/main.rs) | 90 |
7 files changed, 147 insertions, 249 deletions
diff --git a/examples/render-bsp/data/newtest.bsp b/examples/render-bsp/data/newtest.bsp Binary files differdeleted file mode 100644 index a89f408..0000000 --- a/examples/render-bsp/data/newtest.bsp +++ /dev/null diff --git a/examples/render-bsp/data/newtest.map b/examples/render-bsp/data/newtest.map deleted file mode 100644 index 8ad8889..0000000 --- a/examples/render-bsp/data/newtest.map +++ /dev/null @@ -1,110 +0,0 @@ -// entity 0 -{ -"classname" "worldspawn" -"_q3map2_cmdline" "-meta; -vis -saveprt; -light -fast -filter" -"_q3map2_version" "2.5.17n-git-7d2c6f1a" -// brush 0 -{ -( -192 0 0 ) ( -192 256 0 ) ( -192 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 192 0 0 ) ( 192 -256 0 ) ( 192 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -208 0 ) ( 0 -208 -256 ) ( -256 -208 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 176 0 ) ( 0 176 256 ) ( -256 176 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -192 176 256 ) ( -192 -208 256 ) ( 192 -208 256 ) skies/toxicskydim 0 0 0 0.5 0.5 0 0 0 -( 0 0 320 ) ( 256 0 320 ) ( 0 -256 320 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 1 -{ -( 192 -208 256 ) ( 192 -208 192 ) ( 192 176 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -208 0 ) ( 0 -208 -256 ) ( -256 -208 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 176 0 ) ( 0 176 256 ) ( -256 176 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 192 176 192 ) ( 192 -208 192 ) ( 256 -208 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( 0 0 256 ) ( 256 0 256 ) ( 0 -256 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 2 -{ -( -192 0 0 ) ( -192 256 0 ) ( -192 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -272 0 ) ( 0 -272 -256 ) ( -256 -272 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -192 -208 256 ) ( -192 -208 192 ) ( 256 -208 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( -192 -208 192 ) ( -192 -272 192 ) ( 256 -272 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( 0 0 256 ) ( 256 0 256 ) ( 0 -256 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 3 -{ -( -256 0 0 ) ( -256 256 0 ) ( -256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -192 176 256 ) ( -192 176 192 ) ( -192 -272 192 ) base_floor/concrete 0 0 -0 0.5 0.5 0 0 0 -( 0 -272 0 ) ( 0 -272 -256 ) ( -256 -272 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 176 0 ) ( 0 176 256 ) ( -256 176 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -256 176 192 ) ( -256 -272 192 ) ( -192 -272 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( 0 0 256 ) ( 256 0 256 ) ( 0 -256 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 4 -{ -( -256 0 0 ) ( -256 256 0 ) ( -256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 176 256 ) ( 256 176 192 ) ( -256 176 192 ) base_floor/concrete 0 0 -0 0.5 0.5 0 0 0 -( 0 240 0 ) ( 0 240 256 ) ( -256 240 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -256 240 192 ) ( -256 176 192 ) ( 256 176 192 ) base_floor/concrete 0 0 0 0.5 0.5 0 0 0 -( 0 0 256 ) ( 256 0 256 ) ( 0 -256 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 5 -{ -( -256 0 0 ) ( -256 256 0 ) ( -256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -336 0 ) ( 0 -336 -256 ) ( -256 -336 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -256 -272 192 ) ( -256 -272 -256 ) ( 256 -272 -256 ) base_wall/bluemetal2 0 0 0 0.5 0.5 0 0 0 -( 0 0 -256 ) ( -256 0 -256 ) ( 0 -256 -256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 192 ) ( 256 0 192 ) ( 0 -256 192 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 6 -{ -( -256 0 0 ) ( -256 256 0 ) ( -256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 240 192 ) ( 256 240 -256 ) ( -256 240 -256 ) base_wall/bluemetal2 0 0 -0 0.5 0.5 0 0 0 -( 0 304 0 ) ( 0 304 256 ) ( -256 304 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 -256 ) ( -256 0 -256 ) ( 0 -256 -256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 192 ) ( 256 0 192 ) ( 0 -256 192 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 7 -{ -( -320 0 0 ) ( -320 256 0 ) ( -320 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -256 240 192 ) ( -256 240 -256 ) ( -256 -272 -256 ) base_wall/bluemetal2 0 0 -0 0.5 0.5 0 0 0 -( 0 -272 0 ) ( 0 -272 -256 ) ( -256 -272 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 240 0 ) ( 0 240 256 ) ( -256 240 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 -256 ) ( -256 0 -256 ) ( 0 -256 -256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 192 ) ( 256 0 192 ) ( 0 -256 192 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 8 -{ -( 256 -272 192 ) ( 256 -272 -256 ) ( 256 240 -256 ) base_wall/bluemetal2 0 0 0 0.5 0.5 0 0 0 -( 320 0 0 ) ( 320 -256 0 ) ( 320 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -272 0 ) ( 0 -272 -256 ) ( -256 -272 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 240 0 ) ( 0 240 256 ) ( -256 240 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 -256 ) ( -256 0 -256 ) ( 0 -256 -256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 192 ) ( 256 0 192 ) ( 0 -256 192 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -} -// brush 9 -{ -( -256 0 0 ) ( -256 256 0 ) ( -256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 256 0 0 ) ( 256 -256 0 ) ( 256 0 256 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 -272 0 ) ( 0 -272 -256 ) ( -256 -272 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 240 0 ) ( 0 240 256 ) ( -256 240 0 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( 0 0 -320 ) ( -256 0 -320 ) ( 0 -256 -320 ) common/caulk 0 0 0 0.25 0.25 0 0 0 -( -256 -272 -256 ) ( -256 240 -256 ) ( 256 240 -256 ) base_floor/clang_floor2 0 0 -0 0.5 0.5 0 0 0 -} -// brush 10 -{ -( 192 64 64 ) ( 192 0 64 ) ( 128 64 64 ) gothic_trim/gothgrate2 0 0 0 0.5 0.5 0 0 0 -( 192 64 64 ) ( 128 64 64 ) ( 192 64 -576 ) gothic_trim/newskull 0 -0 0 0.5 0.5 0 0 0 -( 192 64 56 ) ( 192 64 -584 ) ( 192 0 56 ) gothic_trim/tower_top 0 496 0 0.5 0.5 0 0 0 -( 144 0 0 ) ( 208 0 0 ) ( 144 64 0 ) gothic_trim/pitted_rust3_dkred 480 0 0 0.5 0.5 0 0 0 -( 128 0 -576 ) ( 128 0 64 ) ( 192 0 -576 ) gothic_trim/metalsupport4b 0 -0 0 0.5 0.5 0 0 0 -( 128 0 -576 ) ( 128 64 -576 ) ( 128 0 64 ) gothic_trim/metalsupport4i_bit 0 -0 0 0.5 0.5 0 0 0 -} -} -// entity 1 -{ -"classname" "info_player_start" -"origin" "-8.000000 -6.000000 15.000000" -} diff --git a/examples/render-bsp/data/test.bsp b/examples/render-bsp/data/test.bsp Binary files differdeleted file mode 100644 index 2aa0334..0000000 --- a/examples/render-bsp/data/test.bsp +++ /dev/null diff --git a/examples/render-bsp/data/test.map b/examples/render-bsp/data/test.map deleted file mode 100644 index 9f4915f..0000000 --- a/examples/render-bsp/data/test.map +++ /dev/null @@ -1,116 +0,0 @@ -// Generated by Q3Map2 (ydnar) -convert -format map -// entity 0 -{ - "classname" "worldspawn" - "_q3map2_cmdline" "-meta; -vis -saveprt; -light -fast -filter" - "_q3map2_version" "2.5.17n-git-7d2c6f1a" - - // brush 0 - { - ( -192.000 0.000 0.000 ) ( -192.000 256.000 0.000 ) ( -192.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 192.000 0.000 0.000 ) ( 192.000 -256.000 0.000 ) ( 192.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -208.000 0.000 ) ( 0.000 -208.000 -256.000 ) ( -256.000 -208.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 176.000 0.000 ) ( 0.000 176.000 256.000 ) ( -256.000 176.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -192.000 176.000 256.000 ) ( -192.000 -208.000 256.000 ) ( 192.000 -208.000 256.000 ) skies/toxicskydim 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 320.000 ) ( 256.000 0.000 320.000 ) ( 0.000 -256.000 320.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 1 - { - ( 192.000 -208.000 256.000 ) ( 192.000 -208.000 192.000 ) ( 192.000 176.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -208.000 0.000 ) ( 0.000 -208.000 -256.000 ) ( -256.000 -208.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 176.000 0.000 ) ( 0.000 176.000 256.000 ) ( -256.000 176.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 192.000 176.000 192.000 ) ( 192.000 -208.000 192.000 ) ( 256.000 -208.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 256.000 ) ( 256.000 0.000 256.000 ) ( 0.000 -256.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 2 - { - ( -192.000 0.000 0.000 ) ( -192.000 256.000 0.000 ) ( -192.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -272.000 0.000 ) ( 0.000 -272.000 -256.000 ) ( -256.000 -272.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -192.000 -208.000 256.000 ) ( -192.000 -208.000 192.000 ) ( 256.000 -208.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( -192.000 -208.000 192.000 ) ( -192.000 -272.000 192.000 ) ( 256.000 -272.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 256.000 ) ( 256.000 0.000 256.000 ) ( 0.000 -256.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 3 - { - ( -256.000 0.000 0.000 ) ( -256.000 256.000 0.000 ) ( -256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -192.000 176.000 256.000 ) ( -192.000 176.000 192.000 ) ( -192.000 -272.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 -0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 -272.000 0.000 ) ( 0.000 -272.000 -256.000 ) ( -256.000 -272.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 176.000 0.000 ) ( 0.000 176.000 256.000 ) ( -256.000 176.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -256.000 176.000 192.000 ) ( -256.000 -272.000 192.000 ) ( -192.000 -272.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 256.000 ) ( 256.000 0.000 256.000 ) ( 0.000 -256.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 4 - { - ( -256.000 0.000 0.000 ) ( -256.000 256.000 0.000 ) ( -256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 176.000 256.000 ) ( 256.000 176.000 192.000 ) ( -256.000 176.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 -0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 240.000 0.000 ) ( 0.000 240.000 256.000 ) ( -256.000 240.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -256.000 240.000 192.000 ) ( -256.000 176.000 192.000 ) ( 256.000 176.000 192.000 ) base_floor/concrete 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 256.000 ) ( 256.000 0.000 256.000 ) ( 0.000 -256.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 5 - { - ( -256.000 0.000 0.000 ) ( -256.000 256.000 0.000 ) ( -256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -336.000 0.000 ) ( 0.000 -336.000 -256.000 ) ( -256.000 -336.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -256.000 -272.000 192.000 ) ( -256.000 -272.000 -256.000 ) ( 256.000 -272.000 -256.000 ) base_wall/bluemetal2 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 0.000 -256.000 ) ( -256.000 0.000 -256.000 ) ( 0.000 -256.000 -256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 192.000 ) ( 256.000 0.000 192.000 ) ( 0.000 -256.000 192.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 6 - { - ( -256.000 0.000 0.000 ) ( -256.000 256.000 0.000 ) ( -256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 240.000 192.000 ) ( 256.000 240.000 -256.000 ) ( -256.000 240.000 -256.000 ) base_wall/bluemetal2 0.00000000 0.00000000 -0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 304.000 0.000 ) ( 0.000 304.000 256.000 ) ( -256.000 304.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 -256.000 ) ( -256.000 0.000 -256.000 ) ( 0.000 -256.000 -256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 192.000 ) ( 256.000 0.000 192.000 ) ( 0.000 -256.000 192.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 7 - { - ( -320.000 0.000 0.000 ) ( -320.000 256.000 0.000 ) ( -320.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -256.000 240.000 192.000 ) ( -256.000 240.000 -256.000 ) ( -256.000 -272.000 -256.000 ) base_wall/bluemetal2 0.00000000 0.00000000 -0.00000000 0.50000000 0.50000000 0 0 0 - ( 0.000 -272.000 0.000 ) ( 0.000 -272.000 -256.000 ) ( -256.000 -272.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 240.000 0.000 ) ( 0.000 240.000 256.000 ) ( -256.000 240.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 -256.000 ) ( -256.000 0.000 -256.000 ) ( 0.000 -256.000 -256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 192.000 ) ( 256.000 0.000 192.000 ) ( 0.000 -256.000 192.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 8 - { - ( 256.000 -272.000 192.000 ) ( 256.000 -272.000 -256.000 ) ( 256.000 240.000 -256.000 ) base_wall/bluemetal2 0.00000000 0.00000000 0.00000000 0.50000000 0.50000000 0 0 0 - ( 320.000 0.000 0.000 ) ( 320.000 -256.000 0.000 ) ( 320.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -272.000 0.000 ) ( 0.000 -272.000 -256.000 ) ( -256.000 -272.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 240.000 0.000 ) ( 0.000 240.000 256.000 ) ( -256.000 240.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 -256.000 ) ( -256.000 0.000 -256.000 ) ( 0.000 -256.000 -256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 192.000 ) ( 256.000 0.000 192.000 ) ( 0.000 -256.000 192.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - } - - // brush 9 - { - ( -256.000 0.000 0.000 ) ( -256.000 256.000 0.000 ) ( -256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 256.000 0.000 0.000 ) ( 256.000 -256.000 0.000 ) ( 256.000 0.000 256.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 -272.000 0.000 ) ( 0.000 -272.000 -256.000 ) ( -256.000 -272.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 240.000 0.000 ) ( 0.000 240.000 256.000 ) ( -256.000 240.000 0.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( 0.000 0.000 -320.000 ) ( -256.000 0.000 -320.000 ) ( 0.000 -256.000 -320.000 ) common/caulk 0.00000000 0.00000000 0.00000000 0.25000000 0.25000000 0 0 0 - ( -256.000 -272.000 -256.000 ) ( -256.000 240.000 -256.000 ) ( 256.000 240.000 -256.000 ) base_floor/clang_floor2 0.00000000 0.00000000 -0.00000000 0.50000000 0.50000000 0 0 0 - } - -} - -// entity 1 -{ - "classname" "info_player_start" - "origin" "-8.000000 -6.000000 15.000000" - -} - diff --git a/examples/render-bsp/Cargo.toml b/examples/render-quad/Cargo.toml index bdbab89..d32aa6e 100644 --- a/examples/render-bsp/Cargo.toml +++ b/examples/render-quad/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "render-bsp" +name = "render-quad" version = "0.1.0" authors = ["Oscar <oscar.shrimpton.personal@gmail.com>"] edition = "2018" diff --git a/examples/render-quad/src/level.rs b/examples/render-quad/src/level.rs new file mode 100644 index 0000000..d10c3b6 --- /dev/null +++ b/examples/render-quad/src/level.rs @@ -0,0 +1,78 @@ +use stockton_levels::parts::{ + data::{FaceRef, Geometry, TextureRef}, + HasFaces, HasTextures, HasVisData, IsFace, IsTexture, +}; + +pub struct DemoLevel { + pub faces: Box<[Face]>, + pub textures: Box<[Texture]>, +} + +impl DemoLevel { + fn face_idx(&self, search: &Face) -> FaceRef { + for (idx, face) in self.faces.iter().enumerate() { + if face == search { + return idx as u32; + } + } + panic!("face not in level") + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Face { + pub geometry: Geometry, + pub texture_idx: TextureRef, +} + +impl HasFaces for DemoLevel { + type Face = Face; + + fn get_face(&self, index: FaceRef) -> Option<&Self::Face> { + self.faces.get(index as usize) + } +} + +impl IsFace<DemoLevel> for Face { + fn index(&self, container: &DemoLevel) -> stockton_levels::parts::data::FaceRef { + container.face_idx(self) + } + + fn geometry(&self, _container: &DemoLevel) -> Geometry { + self.geometry.clone() + } + + fn texture_idx(&self, _container: &DemoLevel) -> TextureRef { + self.texture_idx + } +} + +pub struct Texture { + pub name: String, +} + +impl HasTextures for DemoLevel { + type Texture = Texture; + + fn get_texture(&self, idx: TextureRef) -> Option<&Self::Texture> { + self.textures.get(idx as usize) + } +} + +impl IsTexture for Texture { + fn name(&self) -> &str { + &self.name + } +} + +impl<'a> HasVisData<'a> for DemoLevel { + type Faces = std::ops::Range<FaceRef>; + + fn get_visible( + &'a self, + _transform: &stockton_types::components::Transform, + _settings: &stockton_types::components::CameraSettings, + ) -> Self::Faces { + 0..self.faces.len() as u32 + } +} diff --git a/examples/render-bsp/src/main.rs b/examples/render-quad/src/main.rs index 73475c0..b16c3d0 100644 --- a/examples/render-bsp/src/main.rs +++ b/examples/render-quad/src/main.rs @@ -1,4 +1,4 @@ -//! Renders ./example.bsp +//! Renders ./example.bsp geometry: (), texture_idx: () geometry: (), texture_idx: () #[macro_use] extern crate stockton_input_codegen; @@ -9,9 +9,11 @@ extern crate legion; use anyhow::{Context, Result}; use log::warn; use std::collections::BTreeMap; -use std::fs::File; -use std::io::Read; -use std::path::Path; + +use std::sync::{Arc, RwLock}; +use stockton_levels::parts::data::{Geometry, Vertex}; +use stockton_levels::types::Rgba; +use stockton_render::draw::LevelDrawPass; use winit::{event::Event, event_loop::EventLoop, window::WindowBuilder}; use egui::{containers::CentralPanel, Frame}; @@ -19,16 +21,18 @@ use stockton_contrib::delta_time::*; use stockton_contrib::flycam::*; use stockton_input::{Axis, InputManager, Mouse}; -use stockton_levels::prelude::*; use stockton_render::error::full_error_display; use stockton_render::systems::*; use stockton_render::{Renderer, UiState, WindowEvent}; -use stockton_types::components::{CameraSettings, Transform}; -use stockton_types::{Session, Vector3}; +use stockton_types::components::{CameraSettings, CameraVPMatrix, Transform}; +use stockton_types::{Session, Vector2, Vector3}; + +mod level; +use level::*; -type MapFile = (); +type Dp<'a> = LevelDrawPass<'a, DemoLevel>; #[derive(InputManager, Default, Clone, Debug)] struct MovementInputs { @@ -69,7 +73,7 @@ fn main() { } } -fn try_main() -> Result<()> { +fn try_main<'a>() -> Result<()> { // Initialise logger simplelog::TermLogger::init( log::LevelFilter::Debug, @@ -94,18 +98,37 @@ fn try_main() -> Result<()> { window.set_cursor_visible(false); // TODO: Parse the map file - let map = todo!(); + let map = Arc::new(RwLock::new(DemoLevel { + faces: vec![Face { + geometry: Geometry::Vertices( + Vertex { + position: Vector3::new(-128.0, 128.0, 128.0), + tex: Vector2::new(0.0, 0.0), + color: Rgba::from_slice(&[0, 0, 0, 1]), + }, + Vertex { + position: Vector3::new(-128.0, -128.0, 128.0), + tex: Vector2::new(0.0, 1.0), + color: Rgba::from_slice(&[0, 0, 0, 1]), + }, + Vertex { + position: Vector3::new(128.0, 128.0, 128.0), + tex: Vector2::new(1.0, 0.0), + color: Rgba::from_slice(&[0, 0, 0, 1]), + }, + ), + texture_idx: 0, + }] + .into_boxed_slice(), + textures: vec![Texture { + name: "example_texture".to_string(), + }] + .into_boxed_slice(), + })); // Create the UI State let mut ui = UiState::new(); - // Create the renderer - let (renderer, tx) = Renderer::new(&window)?; - let new_control_flow = renderer.update_control_flow.clone(); - - // Populate the initial UI state - ui.populate_initial_state(&renderer); - // Create the input manager let manager = { use stockton_input::InputMutation::*; @@ -123,10 +146,11 @@ fn try_main() -> Result<()> { MovementInputsManager::new(actions) }; + let ratio = window.inner_size().width as f32 / window.inner_size().height as f32; + // Load everything into the session let mut session = Session::new( move |resources| { - resources.insert(ui); resources.insert(map); resources.insert(manager); resources.insert(Timing::default()); @@ -135,16 +159,20 @@ fn try_main() -> Result<()> { move |schedule| { schedule .add_system(update_deltatime_system()) - .add_system(process_window_events_system::<MovementInputsManager, MapFile>()) + .add_system(process_window_events_system::< + MovementInputsManager, + Dp<'static>, + >()) .flush() .add_system(hello_world_system()) .add_system(flycam_move_system::<MovementInputsManager>()) - .flush(); + .flush() + .add_thread_local(calc_vp_matrix_system(ratio)); }, ); // Add our player entity - let _player = session.world.push(( + let player = session.world.push(( Transform { position: Vector3::new(0.0, 0.0, 0.0), rotation: Vector3::new(0.0, 0.0, 0.0), @@ -154,9 +182,20 @@ fn try_main() -> Result<()> { fov: 90.0, near: 0.1, }, + CameraVPMatrix::default(), FlycamControlled::new(512.0, 400.0), )); + // Create the renderer + let (renderer, tx): (Renderer<Dp<'static>>, _) = Renderer::new(&window, &session, player)?; + let new_control_flow = renderer.update_control_flow.clone(); + + // Populate the initial UI state + ui.populate_initial_state(&renderer); + + session.resources.insert(renderer); + session.resources.insert(ui); + // Done loading - This is our main loop. // It just communicates events to the session and continuously ticks event_loop.run(move |event, _, flow| { @@ -164,7 +203,14 @@ fn try_main() -> Result<()> { Event::MainEventsCleared => { window.request_redraw(); } - Event::RedrawRequested(_) => session.do_update(), + Event::RedrawRequested(_) => { + session.do_update(); + let mut renderer = session + .resources + .get_mut::<Renderer<Dp<'static>>>() + .unwrap(); + renderer.render(&session).unwrap(); + } _ => { if let Some(we) = WindowEvent::from(&event) { tx.send(we).unwrap() |