@ -71,6 +71,7 @@ public class RenderDeviceJme implements RenderDevice {
private final Quad quad = new Quad ( 1 , - 1 , true ) ;
private final Geometry quadGeom = new Geometry ( "nifty-quad" , quad ) ;
private final Material niftyMat ;
private final Material niftyQuadMat ;
private boolean clipWasSet = false ;
private BlendMode blendMode = null ;
@ -93,8 +94,10 @@ public class RenderDeviceJme implements RenderDevice {
quadModTC . setUsage ( Usage . Stream ) ;
niftyMat = new Material ( display . getAssetManager ( ) , "Common/MatDefs/Nifty/Nifty.j3md" ) ;
niftyMat = new Material ( display . getAssetManager ( ) , "Common/MatDefs/Nifty/NiftyTex .j3md" ) ;
niftyMat . getAdditionalRenderState ( ) . setDepthTest ( false ) ;
niftyQuadMat = new Material ( display . getAssetManager ( ) , "Common/MatDefs/Nifty/NiftyQuad.j3md" ) ;
niftyQuadMat . getAdditionalRenderState ( ) . setDepthTest ( false ) ;
}
public void setResourceLoader ( NiftyResourceLoader niftyResourceLoader ) {
@ -211,7 +214,6 @@ public class RenderDeviceJme implements RenderDevice {
@Override
public void renderFont ( RenderFont font , String str , int x , int y , Color color , float sizeX , float sizeY ) {
//TODO find out what the f1 param is for
if ( str . length ( ) = = 0 )
return ;
@ -230,7 +232,6 @@ public class RenderDeviceJme implements RenderDevice {
textCacheCurrentFrame . put ( key , text ) ;
niftyMat . setColor ( "Color" , convertColor ( color , tempColor ) ) ;
niftyMat . setBoolean ( "UseTex" , true ) ;
niftyMat . getAdditionalRenderState ( ) . setBlendMode ( RenderState . BlendMode . Alpha ) ;
// niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
text . setMaterial ( niftyMat ) ;
@ -238,8 +239,10 @@ public class RenderDeviceJme implements RenderDevice {
float width = text . getLineWidth ( ) ;
float height = text . getLineHeight ( ) ;
float x0 = x + 0 . 5f * width * ( 1f - sizeX ) ;
float y0 = y + 0 . 5f * height * ( 1f - sizeY ) ;
// System.out.println("----------------------------------------------------");
// System.out.println("POS "+x+" "+width+" "+sizeX);
float x0 = x + 0 . 5f * width * ( 1 . 0f - sizeX ) ;
float y0 = y + 0 . 5f * height * ( 1 . 0f - sizeY ) ;
tempMat . loadIdentity ( ) ;
tempMat . setTranslation ( x0 , getHeight ( ) - y0 , 0 ) ;
@ -261,7 +264,6 @@ public class RenderDeviceJme implements RenderDevice {
niftyMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyMat . setColor ( "Color" , ColorRGBA . White ) ;
niftyMat . setTexture ( "Texture" , texture ) ;
niftyMat . setBoolean ( "UseTex" , true ) ;
setColor ( color ) ;
float imageWidth = jmeImage . getWidth ( ) ;
@ -308,7 +310,6 @@ public class RenderDeviceJme implements RenderDevice {
niftyMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyMat . setColor ( "Color" , ColorRGBA . White ) ;
niftyMat . setTexture ( "Texture" , jmeImage . getTexture ( ) ) ;
niftyMat . setBoolean ( "UseTex" , true ) ;
setColor ( color ) ;
quad . clearBuffer ( Type . TexCoord ) ;
@ -328,10 +329,8 @@ public class RenderDeviceJme implements RenderDevice {
}
public void renderQuad ( int x , int y , int width , int height , Color color ) {
niftyMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyMat . setColor ( "Color" , ColorRGBA . White ) ;
niftyMat . clearParam ( "Texture" ) ;
niftyMat . setBoolean ( "UseTex" , false ) ;
niftyQuadMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyQuadMat . setColor ( "Color" , ColorRGBA . White ) ;
setColor ( color ) ;
tempMat . loadIdentity ( ) ;
@ -339,7 +338,7 @@ public class RenderDeviceJme implements RenderDevice {
tempMat . setScale ( width , height , 0 ) ;
rm . setWorldMatrix ( tempMat ) ;
niftyMat . render ( quadGeom , rm ) ;
niftyQuad Mat . render ( quadGeom , rm ) ;
// System.out.println("renderQuad (Solid)");
}
@ -359,17 +358,15 @@ public class RenderDeviceJme implements RenderDevice {
buf . flip ( ) ;
quadColor . updateData ( buf ) ;
niftyMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyMat . setColor ( "Color" , ColorRGBA . White ) ;
niftyMat . clearParam ( "Texture" ) ;
niftyMat . setBoolean ( "UseTex" , false ) ;
niftyQuadMat . getAdditionalRenderState ( ) . setBlendMode ( convertBlend ( ) ) ;
niftyQuadMat . setColor ( "Color" , ColorRGBA . White ) ;
tempMat . loadIdentity ( ) ;
tempMat . setTranslation ( x , getHeight ( ) - y , 0 ) ;
tempMat . setScale ( width , height , 0 ) ;
rm . setWorldMatrix ( tempMat ) ;
niftyMat . render ( quadGeom , rm ) ;
niftyQuad Mat . render ( quadGeom , rm ) ;
//
// System.out.println("renderQuad (Grad)");
}