aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-10-17 20:46:21 +0200
committermetamuffin <metamuffin@disroot.org>2022-10-17 20:46:21 +0200
commitfd1ce9167662f37880b40e8eab4c125c7f2b2b6a (patch)
treed1c77ddfd611caae5497051667f7eaa0c4431c5f
parent781dc2ade098b0cb4e3e68a03477476dbadbf985 (diff)
downloadtrash-map-fd1ce9167662f37880b40e8eab4c125c7f2b2b6a.tar
trash-map-fd1ce9167662f37880b40e8eab4c125c7f2b2b6a.tar.bz2
trash-map-fd1ce9167662f37880b40e8eab4c125c7f2b2b6a.tar.zst
a
-rw-r--r--readme.md5
-rw-r--r--src/main.rs4
-rw-r--r--src/render/mod.rs11
3 files changed, 13 insertions, 7 deletions
diff --git a/readme.md b/readme.md
index ec8b457..c912147 100644
--- a/readme.md
+++ b/readme.md
@@ -2,7 +2,10 @@
A minecraft map renderer.
+**In development**
+
## Usage
-- Unzip a resource pack to `./assets` (the minecraft version jar is a valid resource pack btw)
+- Unzip a resource pack to `./assets` (the minecraft version jar is a valid
+ resource pack btw)
- Run the server in your server's directory: `trash-map`
diff --git a/src/main.rs b/src/main.rs
index d21735e..9757748 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,8 +13,8 @@ fn main() {
let dim = Dimension::new("/home/muffin/containers/games/home/user/server/world/region/");
let renderer = Renderer::new(dim);
- for sx in 0..4 {
- for sy in 0..4 {
+ for sx in 0..2 {
+ for sy in 0..2 {
let view = renderer.render_segment(sx, sy);
info!("saving png");
view.save(format!("/tmp/seg.{sx}.{sy}.png")).unwrap();
diff --git a/src/render/mod.rs b/src/render/mod.rs
index 293e566..9a5bd2d 100644
--- a/src/render/mod.rs
+++ b/src/render/mod.rs
@@ -57,12 +57,15 @@ impl Renderer {
let mut visible = Vec::<((isize, isize, isize), (isize, isize, isize))>::new();
- for ix in (sx * SEG_SIZE)..((sx + 1) * SEG_SIZE) {
- for iy in (sy * (SEG_SIZE * 2))..((sy + 1) * (SEG_SIZE * 2)) {
+ let offx = sx * SEG_SIZE;
+ let offy = sy * SEG_SIZE * 2;
+
+ for ix in 0..SEG_SIZE {
+ for iy in 0..(SEG_SIZE * 2) {
for off in 0..=1 {
let mut y = 319;
- let mut x = -ix + iy;
- let mut z = ix + iy + off;
+ let mut x = -ix - offx + iy + offy;
+ let mut z = ix + offx + iy + offy + off;
loop {
let (solid, has_texture) = solid(x, y, z);
if has_texture {