|
|
@ -29,7 +29,6 @@ |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
package com.jme3.niftygui; |
|
|
|
package com.jme3.niftygui; |
|
|
|
|
|
|
|
|
|
|
|
import com.jme3.font.BitmapText; |
|
|
|
import com.jme3.font.BitmapText; |
|
|
@ -64,22 +63,17 @@ public class RenderDeviceJme implements RenderDevice { |
|
|
|
private NiftyJmeDisplay display; |
|
|
|
private NiftyJmeDisplay display; |
|
|
|
private RenderManager rm; |
|
|
|
private RenderManager rm; |
|
|
|
private Renderer r; |
|
|
|
private Renderer r; |
|
|
|
|
|
|
|
|
|
|
|
private HashMap<String, BitmapText> textCacheLastFrame = new HashMap<String, BitmapText>(); |
|
|
|
private HashMap<String, BitmapText> textCacheLastFrame = new HashMap<String, BitmapText>(); |
|
|
|
private HashMap<String, BitmapText> textCacheCurrentFrame = new HashMap<String, BitmapText>(); |
|
|
|
private HashMap<String, BitmapText> textCacheCurrentFrame = new HashMap<String, BitmapText>(); |
|
|
|
|
|
|
|
|
|
|
|
private final Quad quad = new Quad(1, -1, true); |
|
|
|
private final Quad quad = new Quad(1, -1, true); |
|
|
|
private final Geometry quadGeom = new Geometry("nifty-quad", quad); |
|
|
|
private final Geometry quadGeom = new Geometry("nifty-quad", quad); |
|
|
|
private final Material niftyMat; |
|
|
|
private final Material niftyMat; |
|
|
|
private final Material niftyQuadMat; |
|
|
|
private final Material niftyQuadMat; |
|
|
|
|
|
|
|
|
|
|
|
private boolean clipWasSet = false; |
|
|
|
private boolean clipWasSet = false; |
|
|
|
private BlendMode blendMode = null; |
|
|
|
private BlendMode blendMode = null; |
|
|
|
|
|
|
|
|
|
|
|
private VertexBuffer quadDefaultTC = quad.getBuffer(Type.TexCoord); |
|
|
|
private VertexBuffer quadDefaultTC = quad.getBuffer(Type.TexCoord); |
|
|
|
private VertexBuffer quadModTC = quadDefaultTC.clone(); |
|
|
|
private VertexBuffer quadModTC = quadDefaultTC.clone(); |
|
|
|
private VertexBuffer quadColor; |
|
|
|
private VertexBuffer quadColor; |
|
|
|
|
|
|
|
|
|
|
|
private Matrix4f tempMat = new Matrix4f(); |
|
|
|
private Matrix4f tempMat = new Matrix4f(); |
|
|
|
private ColorRGBA tempColor = new ColorRGBA(); |
|
|
|
private ColorRGBA tempColor = new ColorRGBA(); |
|
|
|
|
|
|
|
|
|
|
@ -111,6 +105,7 @@ public class RenderDeviceJme implements RenderDevice { |
|
|
|
// TODO: Cursor support
|
|
|
|
// TODO: Cursor support
|
|
|
|
public MouseCursor createMouseCursor(String str, int x, int y) { |
|
|
|
public MouseCursor createMouseCursor(String str, int x, int y) { |
|
|
|
return new MouseCursor() { |
|
|
|
return new MouseCursor() { |
|
|
|
|
|
|
|
|
|
|
|
public void dispose() { |
|
|
|
public void dispose() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -160,15 +155,16 @@ public class RenderDeviceJme implements RenderDevice { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private RenderState.BlendMode convertBlend() { |
|
|
|
private RenderState.BlendMode convertBlend() { |
|
|
|
if (blendMode == null) |
|
|
|
if (blendMode == null) { |
|
|
|
return RenderState.BlendMode.Off; |
|
|
|
return RenderState.BlendMode.Off; |
|
|
|
else if (blendMode == BlendMode.BLEND) |
|
|
|
} else if (blendMode == BlendMode.BLEND) { |
|
|
|
return RenderState.BlendMode.Alpha; |
|
|
|
return RenderState.BlendMode.Alpha; |
|
|
|
else if (blendMode == BlendMode.MULIPLY) |
|
|
|
} else if (blendMode == BlendMode.MULIPLY) { |
|
|
|
return RenderState.BlendMode.Modulate; |
|
|
|
return RenderState.BlendMode.Modulate; |
|
|
|
else |
|
|
|
} else { |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int convertColor(Color color) { |
|
|
|
private int convertColor(Color color) { |
|
|
|
int color2 = 0; |
|
|
|
int color2 = 0; |
|
|
@ -214,11 +210,13 @@ public class RenderDeviceJme implements RenderDevice { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) { |
|
|
|
public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) { |
|
|
|
if (str.length() == 0) |
|
|
|
if (str.length() == 0) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (font instanceof RenderFontNull) |
|
|
|
if (font instanceof RenderFontNull) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RenderFontJme jmeFont = (RenderFontJme) font; |
|
|
|
RenderFontJme jmeFont = (RenderFontJme) font; |
|
|
|
|
|
|
|
|
|
|
@ -376,7 +374,4 @@ public class RenderDeviceJme implements RenderDevice { |
|
|
|
clipWasSet = false; |
|
|
|
clipWasSet = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|