From 316f2d329370de3febe67ae2a6152883885f4bf1 Mon Sep 17 00:00:00 2001 From: "Blue (Lukas Rieger)" Date: Wed, 22 Jan 2020 20:39:38 +0100 Subject: [PATCH] Add mipmapping where possible and possibly fix grass side overlay for resourcepacks --- BlueMapCore/src/main/webroot/js/libs/BlueMap.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js index 663941b9..55861e45 100644 --- a/BlueMapCore/src/main/webroot/js/libs/BlueMap.js +++ b/BlueMapCore/src/main/webroot/js/libs/BlueMap.js @@ -37,6 +37,7 @@ import { MeshLambertMaterial, NormalBlending, NearestFilter, + NearestMipmapLinearFilter, PerspectiveCamera, Scene, Texture, @@ -89,7 +90,7 @@ export default class BlueMap { this.initModules(); this.start(); }).catch(error => { - this.onLoadError(error.toString()) + this.onLoadError(error.toString()); console.error(error); }); } @@ -364,9 +365,11 @@ export default class BlueMap { for (let i = 0; i < textures['textures'].length; i++) { let t = textures['textures'][i]; + let opaque = t['color'][3] === 1; + let transparent = t['transparent']; let material = new MeshLambertMaterial({ - transparent: t['transparent'], - alphaTest: 0.01, + transparent: transparent, + alphaTest: transparent ? 0 : (opaque ? 1 : 0.01), depthWrite: true, depthTest: true, blending: NormalBlending, @@ -378,15 +381,15 @@ export default class BlueMap { let texture = new Texture(); texture.image = stringToImage(t['texture']); - texture.premultiplyAlpha = false; - texture.generateMipmaps = false; + texture.anisotropy = 1; + texture.generateMipmaps = opaque || transparent; texture.magFilter = NearestFilter; - texture.minFilter = NearestFilter; + texture.minFilter = texture.generateMipmaps ? NearestMipmapLinearFilter : NearestFilter; texture.wrapS = ClampToEdgeWrapping; texture.wrapT = ClampToEdgeWrapping; texture.flipY = false; - texture.needsUpdate = true; texture.flatShading = true; + texture.needsUpdate = true; material.map = texture; material.needsUpdate = true;