From 130283914e2045e577fe2151ed4e39931cf82064 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Fri, 21 Oct 2011 00:46:56 +0000 Subject: [PATCH] * Fix nifty border rendering gradient * Fix nifty text black borders or not getting rendered git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8469 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/niftygui/RenderDeviceJme.java | 18 ++++++++++++++++-- .../com/jme3/niftygui/RenderImageJme.java | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java index 1e77506a0..9e2cc77cd 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java @@ -54,7 +54,6 @@ import de.lessvoid.nifty.tools.Color; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.util.HashMap; -import java.util.Map; public class RenderDeviceJme implements RenderDevice { @@ -129,6 +128,8 @@ public class RenderDeviceJme implements RenderDevice { textCacheLastFrame = textCacheCurrentFrame; textCacheCurrentFrame = temp; textCacheCurrentFrame.clear(); + +// System.exit(1); } public int getWidth() { @@ -206,7 +207,8 @@ public class RenderDeviceJme implements RenderDevice { niftyMat.setColor("Color", convertColor(color, tempColor)); niftyMat.setBoolean("UseTex", true); - niftyMat.getAdditionalRenderState().setBlendMode(convertBlend()); + niftyMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha); +// niftyMat.getAdditionalRenderState().setBlendMode(convertBlend()); text.setMaterial(niftyMat); float width = text.getLineWidth(); @@ -221,6 +223,8 @@ public class RenderDeviceJme implements RenderDevice { rm.setWorldMatrix(tempMat); text.render(rm); + +// System.out.println("renderFont"); } public void renderImage(RenderImage image, int x, int y, int w, int h, @@ -268,6 +272,8 @@ public class RenderDeviceJme implements RenderDevice { rm.setWorldMatrix(tempMat); niftyMat.render(quadGeom, rm); +// +// System.out.println("renderImage (Sub)"); } public void renderImage(RenderImage image, int x, int y, int width, int height, @@ -293,6 +299,8 @@ public class RenderDeviceJme implements RenderDevice { rm.setWorldMatrix(tempMat); niftyMat.render(quadGeom, rm); +// +// System.out.println("renderImage"); } public void renderQuad(int x, int y, int width, int height, Color color){ @@ -308,6 +316,8 @@ public class RenderDeviceJme implements RenderDevice { rm.setWorldMatrix(tempMat); niftyMat.render(quadGeom, rm); + +// System.out.println("renderQuad (Solid)"); } public void renderQuad(int x, int y, int width, int height, @@ -336,14 +346,18 @@ public class RenderDeviceJme implements RenderDevice { rm.setWorldMatrix(tempMat); niftyMat.render(quadGeom, rm); +// +// System.out.println("renderQuad (Grad)"); } public void enableClip(int x0, int y0, int x1, int y1){ +// System.out.println("enableClip"); clipWasSet = true; r.setClipRect(x0, getHeight() - y1, x1 - x0, y1 - y0); } public void disableClip() { +// System.out.println("disableClip"); if (clipWasSet){ r.clearClipRect(); clipWasSet = false; diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java index 8faf32430..e871e8a71 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java @@ -54,8 +54,8 @@ public class RenderImageJme implements RenderImage { key.setGenerateMips(false); texture = (Texture2D) display.getAssetManager().loadTexture(key); - texture.setMagFilter(MagFilter.Bilinear); - texture.setMinFilter(MinFilter.BilinearNoMipMaps); + texture.setMagFilter(linear ? MagFilter.Bilinear : MagFilter.Nearest); + texture.setMinFilter(linear ? MinFilter.BilinearNoMipMaps : MinFilter.NearestNoMipMaps); image = texture.getImage(); width = image.getWidth();