Browse Source

* 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

sha..rd 14 years ago
parent
commit
130283914e

+ 16 - 2
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.ByteBuffer;
 import java.nio.FloatBuffer;
 import java.nio.FloatBuffer;
 import java.util.HashMap;
 import java.util.HashMap;
-import java.util.Map;
 
 
 public class RenderDeviceJme implements RenderDevice {
 public class RenderDeviceJme implements RenderDevice {
 
 
@@ -129,6 +128,8 @@ public class RenderDeviceJme implements RenderDevice {
         textCacheLastFrame = textCacheCurrentFrame;
         textCacheLastFrame = textCacheCurrentFrame;
         textCacheCurrentFrame = temp;
         textCacheCurrentFrame = temp;
         textCacheCurrentFrame.clear();
         textCacheCurrentFrame.clear();
+        
+//        System.exit(1);
     }
     }
 
 
     public int getWidth() {
     public int getWidth() {
@@ -206,7 +207,8 @@ public class RenderDeviceJme implements RenderDevice {
 
 
         niftyMat.setColor("Color", convertColor(color, tempColor));
         niftyMat.setColor("Color", convertColor(color, tempColor));
         niftyMat.setBoolean("UseTex", true);
         niftyMat.setBoolean("UseTex", true);
-        niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
+        niftyMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
+//        niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
         text.setMaterial(niftyMat);
         text.setMaterial(niftyMat);
 
 
         float width = text.getLineWidth();
         float width = text.getLineWidth();
@@ -221,6 +223,8 @@ public class RenderDeviceJme implements RenderDevice {
 
 
         rm.setWorldMatrix(tempMat);
         rm.setWorldMatrix(tempMat);
         text.render(rm);
         text.render(rm);
+        
+//        System.out.println("renderFont");
     }
     }
 
 
     public void renderImage(RenderImage image, int x, int y, int w, int h,
     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);
         rm.setWorldMatrix(tempMat);
         niftyMat.render(quadGeom, rm);
         niftyMat.render(quadGeom, rm);
+//        
+//        System.out.println("renderImage (Sub)");
     }
     }
 
 
     public void renderImage(RenderImage image, int x, int y, int width, int height,
     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);
         rm.setWorldMatrix(tempMat);
         niftyMat.render(quadGeom, rm);
         niftyMat.render(quadGeom, rm);
+//        
+//        System.out.println("renderImage");
     }
     }
 
 
     public void renderQuad(int x, int y, int width, int height, Color color){
     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);
         rm.setWorldMatrix(tempMat);
         niftyMat.render(quadGeom, rm);
         niftyMat.render(quadGeom, rm);
+        
+//        System.out.println("renderQuad (Solid)");
     }
     }
 
 
     public void renderQuad(int x, int y, int width, int height,
     public void renderQuad(int x, int y, int width, int height,
@@ -336,14 +346,18 @@ public class RenderDeviceJme implements RenderDevice {
 
 
         rm.setWorldMatrix(tempMat);
         rm.setWorldMatrix(tempMat);
         niftyMat.render(quadGeom, rm);
         niftyMat.render(quadGeom, rm);
+//        
+//        System.out.println("renderQuad (Grad)");
     }
     }
 
 
     public void enableClip(int x0, int y0, int x1, int y1){
     public void enableClip(int x0, int y0, int x1, int y1){
+//        System.out.println("enableClip");
         clipWasSet = true;
         clipWasSet = true;
         r.setClipRect(x0, getHeight() - y1, x1 - x0, y1 - y0);
         r.setClipRect(x0, getHeight() - y1, x1 - x0, y1 - y0);
     }
     }
 
 
     public void disableClip() {
     public void disableClip() {
+//        System.out.println("disableClip");
         if (clipWasSet){
         if (clipWasSet){
             r.clearClipRect();
             r.clearClipRect();
             clipWasSet = false;
             clipWasSet = false;

+ 2 - 2
engine/src/niftygui/com/jme3/niftygui/RenderImageJme.java

@@ -54,8 +54,8 @@ public class RenderImageJme implements RenderImage {
         key.setGenerateMips(false);
         key.setGenerateMips(false);
         
         
         texture = (Texture2D) display.getAssetManager().loadTexture(key);
         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();
         image = texture.getImage();
 
 
         width = image.getWidth();
         width = image.getWidth();