From a91060dc958402dd0139ecd9280a18b2f7002d07 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 15 Jul 2011 09:29:27 -0500 Subject: [PATCH] Fix non-power-of-two scaling on models and textures --- src/main/java/org/dynmap/hdmap/HDBlockModels.java | 3 ++- src/main/java/org/dynmap/hdmap/TexturePack.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/dynmap/hdmap/HDBlockModels.java b/src/main/java/org/dynmap/hdmap/HDBlockModels.java index 9781d00d..6b8f8eef 100644 --- a/src/main/java/org/dynmap/hdmap/HDBlockModels.java +++ b/src/main/java/org/dynmap/hdmap/HDBlockModels.java @@ -133,6 +133,7 @@ public class HDBlockModels { } else { /* Else, see how much is in first one */ weights[idx] = (offsets[idx] + res) - v; + weights[idx] = (offsets[idx]*res + res) - v; } } /* Now, use weights and indices to fill in scaled map */ @@ -182,7 +183,7 @@ public class HDBlockModels { weights[idx] = res; } else { /* Else, see how much is in first one */ - weights[idx] = (offsets[idx] + nativeres) - v; + weights[idx] = (offsets[idx]*nativeres + nativeres) - v; } } /* Now, use weights and indices to fill in scaled map */ diff --git a/src/main/java/org/dynmap/hdmap/TexturePack.java b/src/main/java/org/dynmap/hdmap/TexturePack.java index 0a527701..d703b072 100644 --- a/src/main/java/org/dynmap/hdmap/TexturePack.java +++ b/src/main/java/org/dynmap/hdmap/TexturePack.java @@ -279,7 +279,7 @@ public class TexturePack { weights[idx] = nativeres; } else { /* Else, see how much is in first one */ - weights[idx] = (offsets[idx] + res) - v; + weights[idx] = (offsets[idx]*res + res) - v; } } /* Now, use weights and indices to fill in scaled map */ @@ -328,7 +328,7 @@ public class TexturePack { weights[idx] = res; } else { /* Else, see how much is in first one */ - weights[idx] = (offsets[idx] + nativeres) - v; + weights[idx] = (offsets[idx]*nativeres + nativeres) - v; } } int accum_red[] = new int[res*res];