diff --git a/engine/lib/nblibraries.properties b/engine/lib/nblibraries.properties index e57776e6f..743e30c0b 100644 --- a/engine/lib/nblibraries.properties +++ b/engine/lib/nblibraries.properties @@ -45,6 +45,7 @@ libs.niftygui1.3.classpath=\ ${base}/niftygui/nifty-examples.jar;\ ${base}/niftygui/nifty-style-black.jar;\ ${base}/niftygui/nifty.jar;\ + ${base}/niftygui/jglfont-core.jar;\ ${base}/niftygui/xmlpull-xpp3.jar libs.niftygui1.3.javadoc=\ ${base}/niftygui/nifty-default-controls-javadoc.jar!//;\ diff --git a/engine/lib/niftygui/VERSION.txt b/engine/lib/niftygui/VERSION.txt index 06046f743..597ebbec9 100644 --- a/engine/lib/niftygui/VERSION.txt +++ b/engine/lib/niftygui/VERSION.txt @@ -1,8 +1,8 @@ -Last Updated 7/10/2012 +Last Updated 9/3/2013 Component Version --------------------------------------------------------------------- -nifty nifty-1.3.2 -nifty-default-controls nifty-default-controls-1.3.2 -nifty-style-black nifty-style-black-1.3.2 -nifty-examples nifty-examples-1.3.2 \ No newline at end of file +nifty nifty-1.3.3-SNAPSHOT +nifty-default-controls nifty-default-controls-1.3.3-SNAPSHOT +nifty-style-black nifty-style-black-1.3.3-SNAPSHOT +nifty-examples nifty-examples-1.3.3-SNAPSHOT diff --git a/engine/lib/niftygui/jglfont-core.jar b/engine/lib/niftygui/jglfont-core.jar new file mode 100644 index 000000000..9ccfdd190 Binary files /dev/null and b/engine/lib/niftygui/jglfont-core.jar differ diff --git a/engine/lib/niftygui/nifty-default-controls-javadoc.jar b/engine/lib/niftygui/nifty-default-controls-javadoc.jar index 02294c74d..8987e7846 100644 Binary files a/engine/lib/niftygui/nifty-default-controls-javadoc.jar and b/engine/lib/niftygui/nifty-default-controls-javadoc.jar differ diff --git a/engine/lib/niftygui/nifty-default-controls.jar b/engine/lib/niftygui/nifty-default-controls.jar index 986d94150..2b38df72b 100644 Binary files a/engine/lib/niftygui/nifty-default-controls.jar and b/engine/lib/niftygui/nifty-default-controls.jar differ diff --git a/engine/lib/niftygui/nifty-examples-javadoc.jar b/engine/lib/niftygui/nifty-examples-javadoc.jar index 0f9faff28..29057bcea 100644 Binary files a/engine/lib/niftygui/nifty-examples-javadoc.jar and b/engine/lib/niftygui/nifty-examples-javadoc.jar differ diff --git a/engine/lib/niftygui/nifty-examples.jar b/engine/lib/niftygui/nifty-examples.jar index aa8a5a836..abdd63a64 100644 Binary files a/engine/lib/niftygui/nifty-examples.jar and b/engine/lib/niftygui/nifty-examples.jar differ diff --git a/engine/lib/niftygui/nifty-javadoc.jar b/engine/lib/niftygui/nifty-javadoc.jar index 0195e1bca..785265b55 100644 Binary files a/engine/lib/niftygui/nifty-javadoc.jar and b/engine/lib/niftygui/nifty-javadoc.jar differ diff --git a/engine/lib/niftygui/nifty-style-black.jar b/engine/lib/niftygui/nifty-style-black.jar index ae0ead368..3071e6c6e 100644 Binary files a/engine/lib/niftygui/nifty-style-black.jar and b/engine/lib/niftygui/nifty-style-black.jar differ diff --git a/engine/lib/niftygui/nifty.jar b/engine/lib/niftygui/nifty.jar index b6cae67b0..5a67b1d44 100644 Binary files a/engine/lib/niftygui/nifty.jar and b/engine/lib/niftygui/nifty.jar differ diff --git a/engine/src/niftygui/com/jme3/niftygui/JmeBatchRenderBackend.java b/engine/src/niftygui/com/jme3/niftygui/JmeBatchRenderBackend.java new file mode 100644 index 000000000..f14d788a4 --- /dev/null +++ b/engine/src/niftygui/com/jme3/niftygui/JmeBatchRenderBackend.java @@ -0,0 +1,514 @@ +/* + * Copyright (c) 2009-2012 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.niftygui; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.ShortBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.jme3.asset.TextureKey; +import com.jme3.material.Material; +import com.jme3.material.RenderState; +import com.jme3.math.Matrix4f; +import com.jme3.renderer.RenderManager; +import com.jme3.renderer.Renderer; +import com.jme3.scene.Geometry; +import com.jme3.scene.Mesh; +import com.jme3.scene.VertexBuffer; +import com.jme3.scene.VertexBuffer.Type; +import com.jme3.scene.VertexBuffer.Usage; +import com.jme3.texture.Image.Format; +import com.jme3.texture.Texture.MagFilter; +import com.jme3.texture.Texture.MinFilter; +import com.jme3.texture.Texture2D; +import com.jme3.util.BufferUtils; + +import de.lessvoid.nifty.batch.spi.BatchRenderBackend; +import de.lessvoid.nifty.render.BlendMode; +import de.lessvoid.nifty.spi.render.MouseCursor; +import de.lessvoid.nifty.tools.Color; +import de.lessvoid.nifty.tools.ObjectPool; +import de.lessvoid.nifty.tools.ObjectPool.Factory; +import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader; + +/** + * Nifty GUI BatchRenderBackend Implementation for jMonkeyEngine. + * @author void + */ +public class JmeBatchRenderBackend implements BatchRenderBackend { + private static Logger log = Logger.getLogger(JmeBatchRenderBackend.class.getName()); + + private final ObjectPool batchPool; + private final List batches = new ArrayList(); + + // a modify texture call needs a jme Renderer to execute. if we're called to modify a texture but don't + // have a Renderer yet - since it was not initialized on the jme side - we'll cache the modify texture calls + // in here and execute them later (at the next beginFrame() call). + private final List modifyTextureCalls = new ArrayList(); + + private RenderManager renderManager; + private NiftyJmeDisplay display; + private Texture2D textureAtlas; + private Batch currentBatch; + private Matrix4f tempMat = new Matrix4f(); + private ByteBuffer initialData; + + // this is only used for debugging purpose and will make the removed textures filled with a color + private boolean fillRemovedTexture = + Boolean.getBoolean(System.getProperty(JmeBatchRenderBackend.class.getName() + ".fillRemovedTexture", "false")); + + public JmeBatchRenderBackend(final NiftyJmeDisplay display) { + this.display = display; + this.batchPool = new ObjectPool(2, new Factory() { + @Override + public Batch createNew() { + return new Batch(); + } + }); + } + + public void setRenderManager(final RenderManager rm) { + this.renderManager = rm; + } + + @Override + public void setResourceLoader(final NiftyResourceLoader resourceLoader) { + } + + @Override + public int getWidth() { + return display.getWidth(); + } + + @Override + public int getHeight() { + return display.getHeight(); + } + + @Override + public void beginFrame() { + log.fine("beginFrame()"); + + for (int i=0; i