From f14e6092874a59081b17c263ed45fcdba58c5096 Mon Sep 17 00:00:00 2001 From: Nehon Date: Mon, 7 Mar 2016 00:30:20 +0100 Subject: [PATCH] Updated MatParam.getAsString to reflect recent change on j3m texture parameter format --- .../main/java/com/jme3/material/MatParam.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/material/MatParam.java b/jme3-core/src/main/java/com/jme3/material/MatParam.java index b94e40fc9..677c17d55 100644 --- a/jme3-core/src/main/java/com/jme3/material/MatParam.java +++ b/jme3-core/src/main/java/com/jme3/material/MatParam.java @@ -248,16 +248,45 @@ When arrays can be inserted in J3M files if (texKey.isFlipY()) { ret += "Flip "; } - if (texVal.getWrap(Texture.WrapAxis.S) == WrapMode.Repeat) { - ret += "Repeat "; + + //Wrap mode + ret += getWrapMode(texVal, Texture.WrapAxis.S); + ret += getWrapMode(texVal, Texture.WrapAxis.T); + ret += getWrapMode(texVal, Texture.WrapAxis.R); + + //Min and Mag filter + Texture.MinFilter def = Texture.MinFilter.BilinearNoMipMaps; + if(texVal.getImage().hasMipmaps() || texKey.isGenerateMips()){ + def = Texture.MinFilter.Trilinear; + } + if(texVal.getMinFilter() != def){ + ret += "Min" + texVal.getMinFilter().name()+ " "; + } + + if(texVal.getMagFilter() != Texture.MagFilter.Bilinear){ + ret += "Mag" + texVal.getMagFilter().name()+ " "; } - return ret + texKey.getName(); + return ret + "\"" + texKey.getName() + "\""; default: return null; // parameter type not supported in J3M } } + private String getWrapMode(Texture texVal, Texture.WrapAxis axis) { + WrapMode mode = WrapMode.EdgeClamp; + try{ + mode = texVal.getWrap(axis); + }catch (IllegalArgumentException e){ + //this axis doesn't exist on the texture + return ""; + } + if(mode != WrapMode.EdgeClamp){ + return"Wrap"+ mode.name() + "_" + axis.name() + " "; + } + return ""; + } + @Override public MatParam clone() { try {